From aca3eef1e7f150e3068c79d2028923f975e0b5aa Mon Sep 17 00:00:00 2001 From: hyxklee Date: Thu, 8 Aug 2024 23:32:18 +0900 Subject: [PATCH] =?UTF-8?q?HOTFIX:=20=EC=A0=95=EA=B8=B0=EB=AA=A8=EC=9E=84?= =?UTF-8?q?=EC=9D=84=20=EC=BA=98=EB=A6=B0=EB=8D=94=EC=97=90=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=ED=95=A0=20=EB=95=8C=20event=EC=99=80=20=EB=8F=99?= =?UTF-8?q?=EC=9D=BC=ED=95=9C=20=ED=98=95=EC=8B=9D=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/application/dto/MeetingDTO.java | 16 +++++++++++++++- .../application/mapper/MeetingMapper.java | 5 +++++ .../application/usecase/MeetingUseCase.java | 4 ++-- .../application/usecase/MeetingUseCaseImpl.java | 8 ++++---- .../presentation/MeetingAdminController.java | 4 ++-- .../schedule/presentation/MeetingController.java | 5 ++--- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/main/java/leets/weeth/domain/schedule/application/dto/MeetingDTO.java b/src/main/java/leets/weeth/domain/schedule/application/dto/MeetingDTO.java index 739e6db8..c4f665e7 100644 --- a/src/main/java/leets/weeth/domain/schedule/application/dto/MeetingDTO.java +++ b/src/main/java/leets/weeth/domain/schedule/application/dto/MeetingDTO.java @@ -8,7 +8,7 @@ public class MeetingDTO { - public record Response( + public record ResponseAll( Long id, String title, String content, @@ -24,6 +24,20 @@ public record Response( LocalDateTime modifiedAt ) {} + public record Response( + Long id, + String title, + String content, + String location, + LocalDateTime start, + LocalDateTime end, + String name, + Integer memberCount, + String requiredItem, + LocalDateTime createdAt, + LocalDateTime modifiedAt + ) {} + public record Save( @NotBlank String title, @NotBlank String content, diff --git a/src/main/java/leets/weeth/domain/schedule/application/mapper/MeetingMapper.java b/src/main/java/leets/weeth/domain/schedule/application/mapper/MeetingMapper.java index cc222298..8b52e99f 100644 --- a/src/main/java/leets/weeth/domain/schedule/application/mapper/MeetingMapper.java +++ b/src/main/java/leets/weeth/domain/schedule/application/mapper/MeetingMapper.java @@ -12,9 +12,14 @@ public interface MeetingMapper { @Mapping(target = "memberCount", expression = "java( getMemberCount(meeting) )") + @Mapping(target = "requiredItem", expression = "java(\"노트북\")") @Mapping(target = "name", source = "user.name") Response to(Meeting meeting); + @Mapping(target = "memberCount", expression = "java( getMemberCount(meeting) )") + @Mapping(target = "name", source = "user.name") + ResponseAll toAll(Meeting meeting); + @Mappings({ @Mapping(target = "id", ignore = true), @Mapping(target = "code", expression = "java( generateCode() )"), diff --git a/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCase.java b/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCase.java index 79c9afaa..071f3019 100644 --- a/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCase.java +++ b/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCase.java @@ -14,7 +14,7 @@ public interface MeetingUseCase { void delete(Long meetingId); - List findAll(Integer cardinal); + List findAll(Integer cardinal); - List findAll(); + List findAll(); } diff --git a/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCaseImpl.java b/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCaseImpl.java index f72d3cf3..6d78b277 100644 --- a/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/schedule/application/usecase/MeetingUseCaseImpl.java @@ -51,16 +51,16 @@ public void delete(Long meetingId) { } @Override - public List findAll(Integer cardinal) { + public List findAll(Integer cardinal) { return meetingGetService.find(cardinal).stream() - .map(mapper::to) + .map(mapper::toAll) .toList(); } @Override - public List findAll() { + public List findAll() { return meetingGetService.findAll().stream() - .map(mapper::to) + .map(mapper::toAll) .toList(); } } diff --git a/src/main/java/leets/weeth/domain/schedule/presentation/MeetingAdminController.java b/src/main/java/leets/weeth/domain/schedule/presentation/MeetingAdminController.java index e2b7abd9..1949d1da 100644 --- a/src/main/java/leets/weeth/domain/schedule/presentation/MeetingAdminController.java +++ b/src/main/java/leets/weeth/domain/schedule/presentation/MeetingAdminController.java @@ -27,13 +27,13 @@ public CommonResponse save(@RequestBody @Valid Save dto, @CurrentUser Long } @PostMapping("/{cardinal}") - public CommonResponse> findAll(@PathVariable Integer cardinal) { + public CommonResponse> findAll(@PathVariable Integer cardinal) { return CommonResponse.createSuccess(meetingUseCase.findAll(cardinal)); } @GetMapping - public CommonResponse> findAll() { + public CommonResponse> findAll() { return CommonResponse.createSuccess(meetingUseCase.findAll()); } diff --git a/src/main/java/leets/weeth/domain/schedule/presentation/MeetingController.java b/src/main/java/leets/weeth/domain/schedule/presentation/MeetingController.java index 51269594..9ab713b8 100644 --- a/src/main/java/leets/weeth/domain/schedule/presentation/MeetingController.java +++ b/src/main/java/leets/weeth/domain/schedule/presentation/MeetingController.java @@ -1,5 +1,6 @@ package leets.weeth.domain.schedule.presentation; +import leets.weeth.domain.schedule.application.dto.MeetingDTO; import leets.weeth.domain.schedule.application.usecase.MeetingUseCase; import leets.weeth.global.common.response.CommonResponse; import lombok.RequiredArgsConstructor; @@ -8,8 +9,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import static leets.weeth.domain.schedule.application.dto.MeetingDTO.Response; - @RestController @RequiredArgsConstructor @RequestMapping("/api/v1/meetings") @@ -18,7 +17,7 @@ public class MeetingController { private final MeetingUseCase meetingUseCase; @GetMapping("/{meetingId}") - public CommonResponse find(@PathVariable Long meetingId) { + public CommonResponse find(@PathVariable Long meetingId) { return CommonResponse.createSuccess(meetingUseCase.find(meetingId)); } }