From 1bc59b25ac4d4793b10be17951a539c26e147519 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 19:16:50 +0900 Subject: [PATCH 01/26] =?UTF-8?q?refactor:=20AdminSummaryResponse=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=ED=95=B4=EC=84=9C=20dto=20=EC=B6=95=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/application/dto/response/UserResponseDto.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java b/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java index 8c6ecb7c..a6496564 100644 --- a/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java +++ b/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java @@ -50,5 +50,10 @@ public record AdminResponse( LocalDateTime modifiedAt ) { } - + public record AdminSummaryResponse( + Integer id, + String name, + List cardinals, + String department + ) {} } From a52ae3c225730fad9696db52c7e3830a3dc4dec8 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 19:17:17 +0900 Subject: [PATCH 02/26] =?UTF-8?q?refactor:=20=EC=B6=95=EC=86=8C=EB=90=9C?= =?UTF-8?q?=20=EB=82=B4=EC=9A=A9=20mapper=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/mapper/UserMapper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java index 54b8fd5a..a45afba7 100644 --- a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java +++ b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java @@ -1,5 +1,6 @@ package leets.weeth.domain.user.application.mapper; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminSummaryResponse; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.entity.enums.Department; import org.mapstruct.*; @@ -26,7 +27,11 @@ public interface UserMapper { // 수정: 출석률, 출석 횟수, 결석 횟수 매핑 추후 추가 예정 }) AdminResponse toAdminResponse(User user); - + @Mappings({ + @Mapping(target = "cardinals", source = "cardinals"), + @Mapping(target = "department", expression = "java(user.getDepartment().getValue())") + }) + AdminSummaryResponse toSummary(User user); default String toString(Department department) { return department.getValue(); } From 039144a9de6a71c08796ace19dedfdcc041695ad Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 19:18:20 +0900 Subject: [PATCH 03/26] =?UTF-8?q?refactor:=20AdminSummaryResponse=EC=97=90?= =?UTF-8?q?=20findAllByAdmin=20=EC=A0=81=EC=9A=A9=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20UserUseCase=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/usecase/UserUseCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java index a2a21f14..4147ad34 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java @@ -19,7 +19,7 @@ public interface UserUseCase { Map> findAll(); - List findAllByAdmin(); + List findAllByAdmin(); void update(Update dto, Long userId); From 7c39040efba2ad2a434ded9c210a9ad667b3369b Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 19:19:19 +0900 Subject: [PATCH 04/26] =?UTF-8?q?refactor:=20UserUseCaseImplcaseimpl?= =?UTF-8?q?=EC=97=90=EC=84=9C=20toSummary=EB=A1=9C=20=EB=A7=A4=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/application/usecase/UserUseCaseImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java index 576c6718..4d9a247a 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java @@ -98,6 +98,7 @@ public void apply(SignUp dto) { @Override public Map> findAll() { return userGetService.findAllByStatus(ACTIVE).stream() + .filter(user -> !"admin".equals(user.getName())) .flatMap(user -> Stream.concat( user.getCardinals().stream() .map(cardinal -> new AbstractMap.SimpleEntry<>(cardinal, mapper.to(user))), // 기수별 Map @@ -108,9 +109,9 @@ public Map> findAll() { } @Override - public List findAllByAdmin() { + public List findAllByAdmin() { return userGetService.findAll().stream() - .map(mapper::toAdminResponse) + .map(mapper::toSummary) .toList(); } From 7aaabc800fd876aff9e27b5c41d15b8db84f5797 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 19:19:55 +0900 Subject: [PATCH 05/26] =?UTF-8?q?refactor:=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=EC=97=90=EC=84=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/presentation/UserAdminController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java index 2bae1138..d27288f0 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java +++ b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java @@ -2,6 +2,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminSummaryResponse; import leets.weeth.domain.user.application.usecase.UserUseCase; import leets.weeth.global.common.response.CommonResponse; import lombok.RequiredArgsConstructor; @@ -22,7 +23,7 @@ public class UserAdminController { @GetMapping("/all") @Operation(summary="어드민용 회원 조회") - public CommonResponse> findAll() { + public CommonResponse> findAll() { return CommonResponse.createSuccess(USER_FIND_ALL_SUCCESS.getMessage(), userUseCase.findAllByAdmin()); } From 70dd74b1cf9170188962b20c4d0b14c713528346 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 19:28:06 +0900 Subject: [PATCH 06/26] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20import=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/presentation/UserAdminController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java index d27288f0..89940c3e 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java +++ b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java @@ -10,7 +10,6 @@ import java.util.List; -import static leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; import static leets.weeth.domain.user.presentation.ResponseMessage.*; @Tag(name = "UserAdminController", description = "유저 관련 어드민 컨트롤러") From a1857755f6ca8257a89d126a9dee245f22f14f79 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 19:28:16 +0900 Subject: [PATCH 07/26] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20import=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/mapper/UserMapper.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java index a45afba7..fab436d2 100644 --- a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java +++ b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java @@ -7,7 +7,6 @@ import org.springframework.security.crypto.password.PasswordEncoder; import static leets.weeth.domain.user.application.dto.request.UserRequestDto.SignUp; -import static leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; import static leets.weeth.domain.user.application.dto.response.UserResponseDto.Response; @Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE) @@ -22,14 +21,10 @@ public interface UserMapper { @Mapping(target = "department", expression = "java( toString(user.getDepartment()) )") Response to(User user); - - @Mappings({ - // 수정: 출석률, 출석 횟수, 결석 횟수 매핑 추후 추가 예정 - }) - AdminResponse toAdminResponse(User user); @Mappings({ @Mapping(target = "cardinals", source = "cardinals"), @Mapping(target = "department", expression = "java(user.getDepartment().getValue())") + // 수정: 출석률, 출석 횟수, 결석 횟수 매핑 추후 추가 예정 }) AdminSummaryResponse toSummary(User user); default String toString(Department department) { From 54aea74825ab64dd407c11104f4dee1f0055b924 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 20:28:40 +0900 Subject: [PATCH 08/26] =?UTF-8?q?feat:=20=ED=8A=B9=EC=A0=95=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=20=EC=83=81=EC=84=B8=EC=A0=95=EB=B3=B4=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=84=B1=EA=B3=B5=20=EB=A9=94=EC=84=B8=EC=A7=80=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leets/weeth/domain/user/presentation/ResponseMessage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/leets/weeth/domain/user/presentation/ResponseMessage.java b/src/main/java/leets/weeth/domain/user/presentation/ResponseMessage.java index 02072875..afa45332 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/ResponseMessage.java +++ b/src/main/java/leets/weeth/domain/user/presentation/ResponseMessage.java @@ -8,6 +8,7 @@ public enum ResponseMessage { // UserAdminController 관련 USER_FIND_ALL_SUCCESS("관리자가 모든 회원 정보를 성공적으로 조회했습니다."), + USER_DETAILS_SUCCESS("특정 회원의 상세 정보를 성공적으로 조회했습니다."), USER_ACCEPT_SUCCESS("회원 가입 승인이 성공적으로 처리되었습니다."), USER_BAN_SUCCESS("회원이 성공적으로 차단되었습니다."), USER_ROLE_UPDATE_SUCCESS("회원의 역할이 성공적으로 수정되었습니다."), From e1c831e0e09686305eededfcb0a01c5555ce4dda Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 20:29:16 +0900 Subject: [PATCH 09/26] =?UTF-8?q?feat:=20toAdminResponse=20=EB=A7=A4?= =?UTF-8?q?=ED=8D=BC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/mapper/UserMapper.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java index fab436d2..2562e243 100644 --- a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java +++ b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java @@ -1,5 +1,6 @@ package leets.weeth.domain.user.application.mapper; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminSummaryResponse; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.entity.enums.Department; @@ -24,9 +25,12 @@ public interface UserMapper { @Mappings({ @Mapping(target = "cardinals", source = "cardinals"), @Mapping(target = "department", expression = "java(user.getDepartment().getValue())") - // 수정: 출석률, 출석 횟수, 결석 횟수 매핑 추후 추가 예정 }) AdminSummaryResponse toSummary(User user); + @Mappings({ + // 수정: 출석률, 출석 횟수, 결석 횟수 매핑 추후 추가 예정 + }) + AdminResponse toAdminResponse(User user); default String toString(Department department) { return department.getValue(); } From c84d593c3485440c1c1b9424d80899620f850945 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 20:30:05 +0900 Subject: [PATCH 10/26] =?UTF-8?q?feat:=20findUserDetails=20UseCase=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/usecase/UserUseCase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java index 4147ad34..7d75ca6a 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java @@ -21,6 +21,8 @@ public interface UserUseCase { List findAllByAdmin(); + AdminResponse findUserDetails(Long userId); + void update(Update dto, Long userId); void accept(Long userId); From dd90a36b87591df58011ffe0c15722c89641ca88 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 20:30:33 +0900 Subject: [PATCH 11/26] =?UTF-8?q?feat:=20findUserDetails=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/application/usecase/UserUseCaseImpl.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java index 4d9a247a..c55031be 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java @@ -6,6 +6,7 @@ import leets.weeth.domain.schedule.domain.service.MeetingGetService; import leets.weeth.domain.user.application.exception.StudentIdExistsException; import leets.weeth.domain.user.application.exception.TelExistsException; +import leets.weeth.domain.user.application.exception.UserNotFoundException; import leets.weeth.domain.user.application.mapper.UserMapper; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.service.UserDeleteService; @@ -33,7 +34,6 @@ import static leets.weeth.domain.user.domain.entity.enums.LoginStatus.LOGIN; import static leets.weeth.domain.user.domain.entity.enums.LoginStatus.REGISTER; import static leets.weeth.domain.user.domain.entity.enums.Status.ACTIVE; - @Service @RequiredArgsConstructor public class UserUseCaseImpl implements UserUseCase { @@ -114,7 +114,14 @@ public List findAllByAdmin() { .map(mapper::toSummary) .toList(); } - + @Override + public AdminResponse findUserDetails(Long userId) { + User user = userGetService.find(userId); + if (user == null) { + throw new UserNotFoundException(); + } + return mapper.toAdminResponse(user); + } @Override public Response find(Long userId) { return mapper.to(userGetService.find(userId)); From 7d2eee89a3dbff1a9dca84a113bd6fd958bae4ea Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 20:30:52 +0900 Subject: [PATCH 12/26] =?UTF-8?q?feat:=20=EC=96=B4=EB=93=9C=EB=AF=BC?= =?UTF-8?q?=EC=9A=A9=20=ED=8A=B9=EC=A0=95=20=EB=A9=A4=EB=B2=84=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/presentation/UserAdminController.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java index 89940c3e..839adfb7 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java +++ b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java @@ -2,6 +2,7 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminSummaryResponse; import leets.weeth.domain.user.application.usecase.UserUseCase; import leets.weeth.global.common.response.CommonResponse; @@ -25,7 +26,14 @@ public class UserAdminController { public CommonResponse> findAll() { return CommonResponse.createSuccess(USER_FIND_ALL_SUCCESS.getMessage(), userUseCase.findAllByAdmin()); } - + @GetMapping("/details") + @Operation(summary = "어드민용 특정 멤버 상세 조회") + public CommonResponse findUserDetails(@RequestParam Long userId) { + return CommonResponse.createSuccess( + USER_DETAILS_SUCCESS.getMessage(), + userUseCase.findUserDetails(userId) + ); + } @PatchMapping @Operation(summary="가입 신청 승인") public CommonResponse accept(@RequestParam Long userId) { From 95e0f35acdd71c7e657082f933186d7b02eb6298 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 22:08:37 +0900 Subject: [PATCH 13/26] =?UTF-8?q?refactor:=20=EC=96=B4=EB=93=9C=EB=AF=BC?= =?UTF-8?q?=EC=9D=B4=20=EC=95=84=EB=8B=8C=20=EC=82=AC=EC=9A=A9=EC=9E=90=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC?= =?UTF-8?q?=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=98=EA=B8=B0=20=EC=9C=84?= =?UTF-8?q?=ED=95=B4=EC=84=9C=20=EB=B3=80=EA=B2=BD=20=EB=82=B4=EC=9A=A9=20?= =?UTF-8?q?=EB=A1=A4=EB=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/application/mapper/UserMapper.java | 10 +++------- .../user/application/usecase/UserUseCase.java | 4 +--- .../application/usecase/UserUseCaseImpl.java | 16 ++++------------ .../user/presentation/UserAdminController.java | 14 +++----------- 4 files changed, 11 insertions(+), 33 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java index 2562e243..54b8fd5a 100644 --- a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java +++ b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java @@ -1,13 +1,12 @@ package leets.weeth.domain.user.application.mapper; -import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; -import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminSummaryResponse; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.entity.enums.Department; import org.mapstruct.*; import org.springframework.security.crypto.password.PasswordEncoder; import static leets.weeth.domain.user.application.dto.request.UserRequestDto.SignUp; +import static leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; import static leets.weeth.domain.user.application.dto.response.UserResponseDto.Response; @Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE) @@ -22,15 +21,12 @@ public interface UserMapper { @Mapping(target = "department", expression = "java( toString(user.getDepartment()) )") Response to(User user); - @Mappings({ - @Mapping(target = "cardinals", source = "cardinals"), - @Mapping(target = "department", expression = "java(user.getDepartment().getValue())") - }) - AdminSummaryResponse toSummary(User user); + @Mappings({ // 수정: 출석률, 출석 횟수, 결석 횟수 매핑 추후 추가 예정 }) AdminResponse toAdminResponse(User user); + default String toString(Department department) { return department.getValue(); } diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java index 7d75ca6a..a2a21f14 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java @@ -19,9 +19,7 @@ public interface UserUseCase { Map> findAll(); - List findAllByAdmin(); - - AdminResponse findUserDetails(Long userId); + List findAllByAdmin(); void update(Update dto, Long userId); diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java index c55031be..576c6718 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java @@ -6,7 +6,6 @@ import leets.weeth.domain.schedule.domain.service.MeetingGetService; import leets.weeth.domain.user.application.exception.StudentIdExistsException; import leets.weeth.domain.user.application.exception.TelExistsException; -import leets.weeth.domain.user.application.exception.UserNotFoundException; import leets.weeth.domain.user.application.mapper.UserMapper; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.service.UserDeleteService; @@ -34,6 +33,7 @@ import static leets.weeth.domain.user.domain.entity.enums.LoginStatus.LOGIN; import static leets.weeth.domain.user.domain.entity.enums.LoginStatus.REGISTER; import static leets.weeth.domain.user.domain.entity.enums.Status.ACTIVE; + @Service @RequiredArgsConstructor public class UserUseCaseImpl implements UserUseCase { @@ -98,7 +98,6 @@ public void apply(SignUp dto) { @Override public Map> findAll() { return userGetService.findAllByStatus(ACTIVE).stream() - .filter(user -> !"admin".equals(user.getName())) .flatMap(user -> Stream.concat( user.getCardinals().stream() .map(cardinal -> new AbstractMap.SimpleEntry<>(cardinal, mapper.to(user))), // 기수별 Map @@ -109,19 +108,12 @@ public Map> findAll() { } @Override - public List findAllByAdmin() { + public List findAllByAdmin() { return userGetService.findAll().stream() - .map(mapper::toSummary) + .map(mapper::toAdminResponse) .toList(); } - @Override - public AdminResponse findUserDetails(Long userId) { - User user = userGetService.find(userId); - if (user == null) { - throw new UserNotFoundException(); - } - return mapper.toAdminResponse(user); - } + @Override public Response find(Long userId) { return mapper.to(userGetService.find(userId)); diff --git a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java index 839adfb7..2bae1138 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java +++ b/src/main/java/leets/weeth/domain/user/presentation/UserAdminController.java @@ -2,8 +2,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; -import leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminSummaryResponse; import leets.weeth.domain.user.application.usecase.UserUseCase; import leets.weeth.global.common.response.CommonResponse; import lombok.RequiredArgsConstructor; @@ -11,6 +9,7 @@ import java.util.List; +import static leets.weeth.domain.user.application.dto.response.UserResponseDto.AdminResponse; import static leets.weeth.domain.user.presentation.ResponseMessage.*; @Tag(name = "UserAdminController", description = "유저 관련 어드민 컨트롤러") @@ -23,17 +22,10 @@ public class UserAdminController { @GetMapping("/all") @Operation(summary="어드민용 회원 조회") - public CommonResponse> findAll() { + public CommonResponse> findAll() { return CommonResponse.createSuccess(USER_FIND_ALL_SUCCESS.getMessage(), userUseCase.findAllByAdmin()); } - @GetMapping("/details") - @Operation(summary = "어드민용 특정 멤버 상세 조회") - public CommonResponse findUserDetails(@RequestParam Long userId) { - return CommonResponse.createSuccess( - USER_DETAILS_SUCCESS.getMessage(), - userUseCase.findUserDetails(userId) - ); - } + @PatchMapping @Operation(summary="가입 신청 승인") public CommonResponse accept(@RequestParam Long userId) { From 1b453a2fa0a34368e1856c1b31d7348d7a6d0da1 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 22:56:10 +0900 Subject: [PATCH 14/26] =?UTF-8?q?refactor:=20=EC=83=81=EC=84=B8=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C,=20=EB=A9=A4=EB=B2=84=20=EA=B8=B0=EC=88=98=EB=B3=84?= =?UTF-8?q?=EB=A1=9C=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?UserMapper=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/mapper/UserMapper.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java index 54b8fd5a..1dddbe49 100644 --- a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java +++ b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java @@ -1,5 +1,6 @@ package leets.weeth.domain.user.application.mapper; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.SummaryResponse; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.entity.enums.Department; import org.mapstruct.*; @@ -26,7 +27,15 @@ public interface UserMapper { // 수정: 출석률, 출석 횟수, 결석 횟수 매핑 추후 추가 예정 }) AdminResponse toAdminResponse(User user); + @Mappings({ + @Mapping(target = "department", expression = "java( toString(user.getDepartment()) )") + }) + SummaryResponse toSummaryResponse(User user); + @Mappings({ + // 상세 데이터 매핑 + }) + Response toResponse(User user); default String toString(Department department) { return department.getValue(); } From 0e250b769c7b277547216493700d8b94f17d8a65 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 22:56:43 +0900 Subject: [PATCH 15/26] =?UTF-8?q?feat:=20SummaryResponse=20dto=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/dto/response/UserResponseDto.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java b/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java index a6496564..dd641ca4 100644 --- a/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java +++ b/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java @@ -30,7 +30,12 @@ public record Response( Role role ) { } - + public record SummaryResponse( + Integer id, + String name, + List cardinals, + String department + ) {} public record AdminResponse( Integer id, String name, @@ -50,10 +55,4 @@ public record AdminResponse( LocalDateTime modifiedAt ) { } - public record AdminSummaryResponse( - Integer id, - String name, - List cardinals, - String department - ) {} } From 8fe021bf8d87ab3de588d4f6db722de755f52caa Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 22:57:28 +0900 Subject: [PATCH 16/26] =?UTF-8?q?feat:=20findAllUser,=20findUserDetails=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/usecase/UserUseCase.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java index a2a21f14..635fdc86 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java @@ -19,8 +19,12 @@ public interface UserUseCase { Map> findAll(); + Map> findAllUser(); + List findAllByAdmin(); + Response findUserDetails(Long userId); + void update(Update dto, Long userId); void accept(Long userId); From d924c650cac95a9dee8b327492e38daed1d02bad Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 22:58:17 +0900 Subject: [PATCH 17/26] =?UTF-8?q?feat:=20findAllUser,=20findUserDetails=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20UserUseCaseImpl=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/usecase/UserUseCaseImpl.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java index 576c6718..0fa03458 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java @@ -6,6 +6,7 @@ import leets.weeth.domain.schedule.domain.service.MeetingGetService; import leets.weeth.domain.user.application.exception.StudentIdExistsException; import leets.weeth.domain.user.application.exception.TelExistsException; +import leets.weeth.domain.user.application.exception.UserNotFoundException; import leets.weeth.domain.user.application.mapper.UserMapper; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.service.UserDeleteService; @@ -106,14 +107,33 @@ public Map> findAll() { .collect(Collectors.groupingBy(Map.Entry::getKey, // key = 기수, value = 유저 정보 Collectors.mapping(Map.Entry::getValue, Collectors.toList()))); } - + @Override + public Map> findAllUser() { + return userGetService.findAllByStatus(ACTIVE).stream() + .flatMap(user -> Stream.concat( + user.getCardinals().stream() + .map(cardinal -> new AbstractMap.SimpleEntry<>(cardinal, mapper.toSummaryResponse(user))), // 기수별 Map + Stream.of(new AbstractMap.SimpleEntry<>(0, mapper.toSummaryResponse(user))) // 모든 기수는 cardinal 0에 저장 + )) + .collect(Collectors.groupingBy( + Map.Entry::getKey, // key = 기수 + Collectors.mapping(Map.Entry::getValue, Collectors.toList()) // value = 요약 정보 리스트 + )); + } @Override public List findAllByAdmin() { return userGetService.findAll().stream() .map(mapper::toAdminResponse) .toList(); } - + @Override + public Response findUserDetails(Long userId) { + User user = userGetService.find(userId); + if (user == null) { + throw new UserNotFoundException(); + } + return mapper.toResponse(user); + } @Override public Response find(Long userId) { return mapper.to(userGetService.find(userId)); From 1d7ae00b8d7abd13568493ddf03f84461069b725 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Wed, 20 Nov 2024 22:58:56 +0900 Subject: [PATCH 18/26] =?UTF-8?q?refactor:=20=EB=8F=99=EC=95=84=EB=A6=AC?= =?UTF-8?q?=20=EB=A9=A4=EB=B2=84=20=EC=A0=84=EC=B2=B4=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EB=B0=8F=20=ED=8A=B9=EC=A0=95=20=EB=A9=A4=EB=B2=84=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=EC=A1=B0=ED=9A=8C=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/presentation/UserController.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/presentation/UserController.java b/src/main/java/leets/weeth/domain/user/presentation/UserController.java index 451c4fa4..6f32ebe6 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/UserController.java +++ b/src/main/java/leets/weeth/domain/user/presentation/UserController.java @@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.SummaryResponse; import leets.weeth.domain.user.application.usecase.UserManageUseCase; import leets.weeth.domain.user.application.usecase.UserUseCase; import leets.weeth.domain.user.domain.service.UserGetService; @@ -58,10 +59,17 @@ public CommonResponse checkEmail(@RequestParam String email) { @GetMapping("/all") @Operation(summary="동아리 멤버 전체 조회(전체/기수별)") - public CommonResponse>> findAll() { - return CommonResponse.createSuccess(USER_FIND_ALL_SUCCESS.getMessage(), userUseCase.findAll()); + public CommonResponse>> findAllUser() { + return CommonResponse.createSuccess(USER_FIND_ALL_SUCCESS.getMessage(), userUseCase.findAllUser()); + } + @GetMapping("/details") + @Operation(summary = "특정 멤버 상세 조회") + public CommonResponse findUser(@RequestParam Long userId) { + return CommonResponse.createSuccess( + USER_DETAILS_SUCCESS.getMessage(), + userUseCase.findUserDetails(userId) + ); } - @GetMapping @Operation(summary="내 정보 조회") public CommonResponse find(@Parameter(hidden = true) @CurrentUser Long userId) { From ea78f3fab9eff7d9b1fa0d500c6a882496d14673 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Fri, 22 Nov 2024 21:13:10 +0900 Subject: [PATCH 19/26] =?UTF-8?q?refactor:=20=EC=9C=A0=EC=A0=80=EA=B0=80?= =?UTF-8?q?=20=EC=A1=B4=EC=9E=AC=ED=95=98=EB=8A=94=EC=A7=80=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=EB=90=9C=20=EA=B2=80=EC=A6=9D=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/application/usecase/UserUseCaseImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java index 0fa03458..49bcaaf3 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java @@ -6,7 +6,6 @@ import leets.weeth.domain.schedule.domain.service.MeetingGetService; import leets.weeth.domain.user.application.exception.StudentIdExistsException; import leets.weeth.domain.user.application.exception.TelExistsException; -import leets.weeth.domain.user.application.exception.UserNotFoundException; import leets.weeth.domain.user.application.mapper.UserMapper; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.service.UserDeleteService; @@ -129,9 +128,6 @@ public List findAllByAdmin() { @Override public Response findUserDetails(Long userId) { User user = userGetService.find(userId); - if (user == null) { - throw new UserNotFoundException(); - } return mapper.toResponse(user); } @Override From 0022c77e10b02e5a9582d97579c2285a64a625ef Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Fri, 22 Nov 2024 21:13:27 +0900 Subject: [PATCH 20/26] =?UTF-8?q?refactor:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=ED=98=95=EC=8B=9D?= =?UTF-8?q?=EA=B3=BC=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leets/weeth/domain/user/presentation/UserController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/presentation/UserController.java b/src/main/java/leets/weeth/domain/user/presentation/UserController.java index 6f32ebe6..45356f29 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/UserController.java +++ b/src/main/java/leets/weeth/domain/user/presentation/UserController.java @@ -66,8 +66,7 @@ public CommonResponse>> findAllUser() { @Operation(summary = "특정 멤버 상세 조회") public CommonResponse findUser(@RequestParam Long userId) { return CommonResponse.createSuccess( - USER_DETAILS_SUCCESS.getMessage(), - userUseCase.findUserDetails(userId) + USER_DETAILS_SUCCESS.getMessage(), userUseCase.findUserDetails(userId) ); } @GetMapping From 80719a5a7d3e4b0ab05b9baed9e3eb0689882f1f Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Fri, 22 Nov 2024 22:04:49 +0900 Subject: [PATCH 21/26] =?UTF-8?q?feat:=20UserResponse=20dto=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/application/dto/response/UserResponseDto.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java b/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java index dd641ca4..bc745fdd 100644 --- a/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java +++ b/src/main/java/leets/weeth/domain/user/application/dto/response/UserResponseDto.java @@ -55,4 +55,14 @@ public record AdminResponse( LocalDateTime modifiedAt ) { } + public record UserResponse( + Integer id, + String name, + String email, + String studentId, + String department, + List cardinals, + Position position + ) { + } } From 4b07c3913509e1dc156a4717afdc70fc1d66a99e Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Fri, 22 Nov 2024 22:05:17 +0900 Subject: [PATCH 22/26] =?UTF-8?q?refactor:=20findUserDetails=EC=9D=B4=20Us?= =?UTF-8?q?erResponse=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weeth/domain/user/application/usecase/UserUseCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java index 635fdc86..870c68a6 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java @@ -23,7 +23,7 @@ public interface UserUseCase { List findAllByAdmin(); - Response findUserDetails(Long userId); + UserResponse findUserDetails(Long userId); void update(Update dto, Long userId); From 07017c8676a15ab0f72348514b360f7e29fd1de9 Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Fri, 22 Nov 2024 22:06:34 +0900 Subject: [PATCH 23/26] =?UTF-8?q?refactor:=20UserResponse=20=EB=A7=A4?= =?UTF-8?q?=ED=8D=BC=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leets/weeth/domain/user/application/mapper/UserMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java index 1dddbe49..51ae5f5b 100644 --- a/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java +++ b/src/main/java/leets/weeth/domain/user/application/mapper/UserMapper.java @@ -1,6 +1,7 @@ package leets.weeth.domain.user.application.mapper; import leets.weeth.domain.user.application.dto.response.UserResponseDto.SummaryResponse; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.UserResponse; import leets.weeth.domain.user.domain.entity.User; import leets.weeth.domain.user.domain.entity.enums.Department; import org.mapstruct.*; @@ -35,7 +36,7 @@ public interface UserMapper { @Mappings({ // 상세 데이터 매핑 }) - Response toResponse(User user); + UserResponse toUserResponse(User user); default String toString(Department department) { return department.getValue(); } From 4325ae889a84023202e53c1ac656c74dda9398be Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Fri, 22 Nov 2024 22:07:05 +0900 Subject: [PATCH 24/26] =?UTF-8?q?refactor:=20UserUseCaseImpl=EC=97=90?= =?UTF-8?q?=EC=84=9C=20findUserDetails=20=EC=98=AC=EB=B0=94=EB=A5=B4?= =?UTF-8?q?=EA=B2=8C=20=EB=A7=A4=ED=95=91=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/application/usecase/UserUseCaseImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java index 49bcaaf3..fa33b3c7 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java @@ -126,9 +126,9 @@ public List findAllByAdmin() { .toList(); } @Override - public Response findUserDetails(Long userId) { + public UserResponse findUserDetails(Long userId) { User user = userGetService.find(userId); - return mapper.toResponse(user); + return mapper.toUserResponse(user); } @Override public Response find(Long userId) { From 7f755ddec73da01500b1fce749d603e596cc94ca Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Fri, 22 Nov 2024 22:07:44 +0900 Subject: [PATCH 25/26] =?UTF-8?q?refactor:=20=ED=8A=B9=EC=A0=95=20?= =?UTF-8?q?=EB=A9=A4=EB=B2=84=20=EC=83=81=EC=84=B8=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EB=B0=98=ED=99=98=20dto=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leets/weeth/domain/user/presentation/UserController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/leets/weeth/domain/user/presentation/UserController.java b/src/main/java/leets/weeth/domain/user/presentation/UserController.java index 45356f29..dec8aa90 100644 --- a/src/main/java/leets/weeth/domain/user/presentation/UserController.java +++ b/src/main/java/leets/weeth/domain/user/presentation/UserController.java @@ -6,6 +6,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; import leets.weeth.domain.user.application.dto.response.UserResponseDto.SummaryResponse; +import leets.weeth.domain.user.application.dto.response.UserResponseDto.UserResponse; import leets.weeth.domain.user.application.usecase.UserManageUseCase; import leets.weeth.domain.user.application.usecase.UserUseCase; import leets.weeth.domain.user.domain.service.UserGetService; @@ -64,7 +65,7 @@ public CommonResponse>> findAllUser() { } @GetMapping("/details") @Operation(summary = "특정 멤버 상세 조회") - public CommonResponse findUser(@RequestParam Long userId) { + public CommonResponse findUser(@RequestParam Long userId) { return CommonResponse.createSuccess( USER_DETAILS_SUCCESS.getMessage(), userUseCase.findUserDetails(userId) ); From 96292f8357c1d020d1cdd3120baddac1e1f1ce5d Mon Sep 17 00:00:00 2001 From: huncozyboy Date: Sat, 23 Nov 2024 22:30:59 +0900 Subject: [PATCH 26/26] =?UTF-8?q?refactor:=20=EA=B8=B0=EC=88=98=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=EC=99=80=20=EC=9A=94=EC=95=BD=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EB=91=90=EA=B0=9C=EC=9D=98=20=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=EB=A6=BC=20=EC=82=AC=EC=9A=A9=ED=95=B4=EC=84=9C=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=ED=98=B8=EC=B6=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/application/usecase/UserUseCaseImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java index fa33b3c7..e13800e6 100644 --- a/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java +++ b/src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java @@ -109,10 +109,10 @@ public Map> findAll() { @Override public Map> findAllUser() { return userGetService.findAllByStatus(ACTIVE).stream() - .flatMap(user -> Stream.concat( - user.getCardinals().stream() - .map(cardinal -> new AbstractMap.SimpleEntry<>(cardinal, mapper.toSummaryResponse(user))), // 기수별 Map - Stream.of(new AbstractMap.SimpleEntry<>(0, mapper.toSummaryResponse(user))) // 모든 기수는 cardinal 0에 저장 + .map(user -> new AbstractMap.SimpleEntry<>(user.getCardinals(), mapper.toSummaryResponse(user))) + .flatMap(entry -> Stream.concat( + entry.getKey().stream().map(cardinal -> new AbstractMap.SimpleEntry<>(cardinal, entry.getValue())), // 기수별 Map + Stream.of(new AbstractMap.SimpleEntry<>(0, entry.getValue())) // 모든 기수는 cardinal 0에 저장 )) .collect(Collectors.groupingBy( Map.Entry::getKey, // key = 기수