diff --git a/backend/docker/docker-compose.yml b/backend/docker/docker-compose.yml index 9f75fe6e3..71480df14 100644 --- a/backend/docker/docker-compose.yml +++ b/backend/docker/docker-compose.yml @@ -33,3 +33,13 @@ services: environment: - "discovery.type=single-node" - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + kibana: + container_name: kibana + image: kibana:7.14.1 + ports: + - "5601:5601" + environment: + ELASTICSEARCH_URL: http://elasticsearch:9200 + ELASTICSEARCH_HOSTS: http://elasticsearch:9200 + restart: always + privileged: true diff --git a/backend/src/main/java/wooteco/prolog/common/ElasticSearchConfig.java b/backend/src/main/java/wooteco/prolog/common/ElasticSearchConfig.java index 4449e0a2d..4614c0708 100644 --- a/backend/src/main/java/wooteco/prolog/common/ElasticSearchConfig.java +++ b/backend/src/main/java/wooteco/prolog/common/ElasticSearchConfig.java @@ -13,7 +13,7 @@ import org.springframework.data.elasticsearch.config.AbstractElasticsearchConfiguration; import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; -@Profile({"dev", "prod"}) +@Profile({"local", "dev", "prod"}) @Configuration @EnableElasticsearchRepositories public class ElasticSearchConfig extends AbstractElasticsearchConfiguration { diff --git a/backend/src/main/java/wooteco/prolog/common/exception/ExceptionController.java b/backend/src/main/java/wooteco/prolog/common/exception/ExceptionController.java index d6a53fcf8..5d89c8ed1 100644 --- a/backend/src/main/java/wooteco/prolog/common/exception/ExceptionController.java +++ b/backend/src/main/java/wooteco/prolog/common/exception/ExceptionController.java @@ -40,6 +40,7 @@ public ResponseEntity runtimeExceptionHandler(Exception e) { log.error(Arrays.stream(e.getStackTrace()).map(it -> it.toString()) .collect(Collectors.joining("\n"))); } else { + e.printStackTrace(); log.error(e.getMessage()); } return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) diff --git a/backend/src/main/java/wooteco/prolog/studylog/application/FakeStudylogDocumentService.java b/backend/src/main/java/wooteco/prolog/studylog/application/FakeStudylogDocumentService.java index 3a49b9912..eb95a1324 100644 --- a/backend/src/main/java/wooteco/prolog/studylog/application/FakeStudylogDocumentService.java +++ b/backend/src/main/java/wooteco/prolog/studylog/application/FakeStudylogDocumentService.java @@ -17,7 +17,7 @@ import wooteco.prolog.studylog.domain.repository.StudylogRepository; import wooteco.prolog.studylog.domain.repository.StudylogSpecification; -@Profile({"local", "test"}) +@Profile({"test"}) @Service public class FakeStudylogDocumentService extends AbstractStudylogDocumentService { diff --git a/backend/src/main/java/wooteco/prolog/studylog/application/StudylogDocumentService.java b/backend/src/main/java/wooteco/prolog/studylog/application/StudylogDocumentService.java index 69370253c..c909f61e6 100644 --- a/backend/src/main/java/wooteco/prolog/studylog/application/StudylogDocumentService.java +++ b/backend/src/main/java/wooteco/prolog/studylog/application/StudylogDocumentService.java @@ -19,7 +19,7 @@ import wooteco.prolog.studylog.domain.repository.StudylogDocumentRepository; import wooteco.prolog.studylog.domain.repository.StudylogRepository; -@Profile({"dev", "prod"}) +@Profile({"local", "dev", "prod"}) @Service public class StudylogDocumentService extends AbstractStudylogDocumentService { diff --git a/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocument.java b/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocument.java index 7a74c40c3..526d41ab3 100644 --- a/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocument.java +++ b/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocument.java @@ -41,6 +41,6 @@ public class StudylogDocument { @Field(type = FieldType.Text) private String username; - @Field(type = FieldType.Text) + @Field(type = FieldType.Date, format = DateFormat.date_optional_time) private LocalDateTime dateTime; } diff --git a/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocumentQueryBuilder.java b/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocumentQueryBuilder.java index 46d20d8d0..6358bcdff 100644 --- a/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocumentQueryBuilder.java +++ b/backend/src/main/java/wooteco/prolog/studylog/domain/StudylogDocumentQueryBuilder.java @@ -66,7 +66,7 @@ private static void makeBoolQuery( .must(defaultField(username, "username")) // .must(defaultField(levels, "levelId")) // .must(defaultField(missions, "missionId")) - .filter(rangeQuery(start, end)) +// .filter(rangeQuery(start, end)) ); } @@ -96,7 +96,6 @@ private static RangeQueryBuilder rangeQuery(LocalDate start, LocalDate end) { if (Objects.isNull(end)) { end = LocalDate.parse("99991231", DateTimeFormatter.BASIC_ISO_DATE); } - return QueryBuilders.rangeQuery("dateTime") .from(start) .to(end); diff --git a/backend/src/main/java/wooteco/prolog/studylog/domain/repository/StudylogDocumentRepository.java b/backend/src/main/java/wooteco/prolog/studylog/domain/repository/StudylogDocumentRepository.java index 6ca09173e..8ae79dee9 100644 --- a/backend/src/main/java/wooteco/prolog/studylog/domain/repository/StudylogDocumentRepository.java +++ b/backend/src/main/java/wooteco/prolog/studylog/domain/repository/StudylogDocumentRepository.java @@ -4,7 +4,7 @@ import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import wooteco.prolog.studylog.domain.StudylogDocument; -@Profile({"dev", "prod"}) +@Profile({"local", "dev", "prod"}) public interface StudylogDocumentRepository extends ElasticsearchRepository { diff --git a/backend/src/main/java/wooteco/prolog/studylog/ui/StudylogController.java b/backend/src/main/java/wooteco/prolog/studylog/ui/StudylogController.java index d0e4d3e9b..4d60ae96f 100644 --- a/backend/src/main/java/wooteco/prolog/studylog/ui/StudylogController.java +++ b/backend/src/main/java/wooteco/prolog/studylog/ui/StudylogController.java @@ -42,10 +42,10 @@ public StudylogController(StudylogService studylogService, } @PostMapping - @MemberOnly +// @MemberOnly public ResponseEntity createStudylog(@AuthMemberPrincipal LoginMember member, @RequestBody StudylogRequest studylogRequest) { - StudylogResponse studylogResponse = studylogService.insertStudylog(member.getId(), + StudylogResponse studylogResponse = studylogService.insertStudylog(1L, studylogRequest); return ResponseEntity.created(URI.create("/studylogs/" + studylogResponse.getId())) .body(studylogResponse); diff --git a/backend/src/main/resources/application-local.yml b/backend/src/main/resources/application-local.yml index 0af0461b8..df7a0b9d9 100644 --- a/backend/src/main/resources/application-local.yml +++ b/backend/src/main/resources/application-local.yml @@ -16,6 +16,8 @@ github: elasticsearch: host: 127.0.0.1 port: 9200 + user: user + password: password manager: role: GUEST