From 660097203dac8a2e895168593e058f3a24dd2698 Mon Sep 17 00:00:00 2001 From: gabang2 Date: Sun, 2 Jun 2024 18:16:38 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=EA=B2=80=EC=83=89=EC=96=B4=20=EA=B5=90?= =?UTF-8?q?=EC=A0=95=20response=20=ED=83=80=EC=9E=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CulturalEventController.java | 20 +++++++++++++++---- .../dto/CulturalEventDetailListDto.java | 17 ++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 src/main/java/project/backend/domain/culturalevent/dto/CulturalEventDetailListDto.java diff --git a/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java b/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java index 569569b..8802d75 100644 --- a/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java +++ b/src/main/java/project/backend/domain/culturalevent/controller/CulturalEventController.java @@ -7,6 +7,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import project.backend.domain.culturalevent.dto.CulturalEventDetailListDto; import project.backend.domain.culturalevent.dto.CulturalEventListDto; import project.backend.domain.culturalevent.dto.CulturalEventRetrieveDto; import project.backend.domain.culturalevent.dto.CulturalEventSearchListDto; @@ -47,7 +48,7 @@ public class CulturalEventController { "`latitude` : 입력시 추천순 정렬에 반경 50km 이내 문화생활 적용\n" + "`longitude` : 입력시 추천순 정렬에 반경 50km 이내 문화생활 적용") @GetMapping - public ResponseEntity getCulturalEventList( + public ResponseEntity getCulturalEventList( @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "10") int size, @RequestParam(required = false) String ordering, @@ -65,15 +66,26 @@ public ResponseEntity getCulturalEventList( culturalEventSearchKeywordService.createCulturalEventSearchKeyword(member, keyword); } - // Get Cultural Event - List culturalEventList = culturalEventService.getCulturalEventList(page, size, categories, ordering, isOpened, latitude, longitude, keyword); + // Get Cultural Event List Dto + List culturalEventList = culturalEventService + .getCulturalEventList(page, size, categories, ordering, isOpened, latitude, longitude, keyword); List culturalEventResponseDtoList = culturalEventMapper .culturalEventToCulturalEventListDtos(culturalEventList); culturalEventResponseDtoList.forEach(dto -> { dto.setIsOpened(); dto.setIsLiked(member); }); - return ResponseEntity.status(HttpStatus.OK).body(culturalEventResponseDtoList); + + // Get Cultural Event Detail List + CulturalEventDetailListDto culturalEventDetailListDto = CulturalEventDetailListDto + .builder() + .searchKeyword(keyword) + .resultKeyword(keyword) + .isKeywordSame(true) + .culturalEvents(culturalEventResponseDtoList) + .build(); + + return ResponseEntity.status(HttpStatus.OK).body(culturalEventDetailListDto); } @ApiOperation(value = "문화생활 검색 리스트 조회") diff --git a/src/main/java/project/backend/domain/culturalevent/dto/CulturalEventDetailListDto.java b/src/main/java/project/backend/domain/culturalevent/dto/CulturalEventDetailListDto.java new file mode 100644 index 0000000..a9f5b61 --- /dev/null +++ b/src/main/java/project/backend/domain/culturalevent/dto/CulturalEventDetailListDto.java @@ -0,0 +1,17 @@ +package project.backend.domain.culturalevent.dto; + +import lombok.*; + +import java.util.List; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CulturalEventDetailListDto { + private String searchKeyword; + private String resultKeyword; + private Boolean isKeywordSame; + private List culturalEvents; +} \ No newline at end of file