Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
version: "3.8"
services:
ketchapp-api:
build: .
ports:
- "8081:8081"
environment:
- GEMINI_API_KEY=AIzaSyCkkuxXPPoohG40PbiIFECLbr7sjAqo-a0
networks:
- ketchapp-net

networks:
ketchapp-net:
external: true
Binary file added src/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public class KetchappApplication {
public static void main(String[] args) {
SpringApplication.run(KetchappApplication.class, args);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,28 @@
import com.alessandra_alessandro.ketchapp.repositories.ActivitiesRepository;
import com.alessandra_alessandro.ketchapp.repositories.TomatoesRepository;
import com.alessandra_alessandro.ketchapp.utils.EntityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TomatoesControllers {
private static final Logger log = LoggerFactory.getLogger(TomatoesControllers.class);

private static final Logger log = LoggerFactory.getLogger(
TomatoesControllers.class
);
final TomatoesRepository tomatoesRepository;
private final ActivitiesRepository activitiesRepository;
private final EntityMapper entityMapper;

@Autowired
public TomatoesControllers(TomatoesRepository tomatoesRepository, ActivitiesRepository activitiesRepository, EntityMapper entityMapper) {
public TomatoesControllers(
TomatoesRepository tomatoesRepository,
ActivitiesRepository activitiesRepository,
EntityMapper entityMapper
) {
this.tomatoesRepository = tomatoesRepository;
this.activitiesRepository = activitiesRepository;
this.entityMapper = entityMapper;
Expand Down Expand Up @@ -59,12 +65,19 @@ public TomatoDto createTomato(TomatoDto tomatoDto) {
*/
public List<ActivityDto> getActivitiesByTomatoId(Integer tomatoId) {
log.info("Fetching activities for tomatoId: {}", tomatoId);
List<ActivityEntity> activities = activitiesRepository.findByTomatoId(tomatoId);
log.info("Found {} activities for tomatoId {}", activities.size(), tomatoId);
List<ActivityDto> result = activities.stream()
.map(entityMapper::activityEntityToDto)
.collect(java.util.stream.Collectors.toList());
List<ActivityEntity> activities = activitiesRepository.findByTomatoId(
tomatoId
);
log.info(
"Found {} activities for tomatoId {}",
activities.size(),
tomatoId
);
List<ActivityDto> result = activities
.stream()
.map(entityMapper::activityEntityToDto)
.collect(java.util.stream.Collectors.toList());
log.info("Mapped activities to ActivityDto list: {}", result);
return result;
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ GEMINI_API_KEY=AIzaSyClXWWxzTCaB6mMZl1Uqcr_3Pe2xZgFHyE

# Kafka Configuration
app.kafka.topic.mail-service=MailService
spring.kafka.bootstrap-servers=151.42.165.160:29092
spring.kafka.bootstrap-servers=kafka:9092
spring.kafka.consumer.group-id=KafkaID
spring.kafka.consumer.auto-offset-reset=earliest
# important for initial consumer
Expand Down
Loading