From 01d8eaa27c81e46100a5ab46c146cd24c090f3da Mon Sep 17 00:00:00 2001 From: chyun Date: Thu, 23 Jan 2025 19:05:46 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix=20[#169]=20=ED=83=80=EC=9E=84=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EC=A1=B0=ED=9A=8C=20=EC=BF=BC=EB=A6=AC?= =?UTF-8?q?=EC=97=90=20@Param=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/repository/UserTimetableRepository.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java b/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java index 92d00eb..904930b 100644 --- a/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java +++ b/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java @@ -19,5 +19,8 @@ public interface UserTimetableRepository extends JpaRepository findByUserIdAndFestivalTimeIds(final long userId, final List festivalTimeIds); + List findByUserIdAndFestivalTimeIds( + final @Param("userId") long userId, + final @Param("festivalTimeIds") List festivalTimeIds + ); } From b0cd07b2e7c4d29e32d18888af8157367a661cdd Mon Sep 17 00:00:00 2001 From: chyun Date: Thu, 23 Jan 2025 19:17:45 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix=20[#169]=20userTimetableMapper=EC=97=90?= =?UTF-8?q?=20FestivalTimeId=EB=A5=BC=20=ED=82=A4=20=EA=B0=92=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../confeti/api/user/controller/UserTimetableController.java | 2 +- .../org/sopt/confeti/api/user/facade/UserTimetableFacade.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java b/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java index 4e57ad3..1aa7424 100644 --- a/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java +++ b/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java @@ -68,7 +68,7 @@ public ResponseEntity> removeTimetableFestival( @GetMapping("/{festivalDateId}") public ResponseEntity> getTimetableFestival( @RequestHeader("Authorization") long userId, - @PathVariable(name = "festivalDateId") @Min(value=0, message="요청 형식이 올바르지 않습니다.") long festivalDateId + @PathVariable(name = "festivalDateId") @Min(value = 0, message = "요청 형식이 올바르지 않습니다.") long festivalDateId ){ UserTimetableFestivalBasicDTO response = userTimetableFacade.getTimetableInfo(userId, festivalDateId); return ApiResponseUtil.success(SuccessMessage.SUCCESS, UserTimetableFestivalResponse.from(response)); diff --git a/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java b/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java index 0542646..fe2c05e 100644 --- a/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java +++ b/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java @@ -167,7 +167,9 @@ public UserTimetableFestivalBasicDTO getTimetableInfo(final long userId, final l List userTimetables = userTimetableService.getUserTimetables(userId, festivalTimeIds); Map userTimetableMapper = userTimetables.stream() - .collect(Collectors.toMap(UserTimetable::getId, Function.identity())); + .collect(Collectors.toMap(userTimetable -> + userTimetable.getFestivalTime().getId(), Function.identity()) + ); return UserTimetableFestivalBasicDTO.of(festivalDate, userTimetableMapper); } From 611e172373350c4cca2038747cfbb26818811a49 Mon Sep 17 00:00:00 2001 From: chyun Date: Thu, 23 Jan 2025 18:32:36 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refactor=20[#167]=20=EC=BB=A8=ED=8A=B8?= =?UTF-8?q?=EB=A1=A4=EB=9F=AC=20=EA=B3=84=EC=B8=B5=EC=97=90=EC=84=9C=20url?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/user/controller/UserInfoController.java | 7 ++++--- .../api/user/dto/response/UserInfoResponse.java | 9 +++++++-- .../confeti/api/user/facade/UserInfoFacade.java | 5 +++-- .../api/user/facade/dto/response/UserInfoDTO.java | 14 +++++++++++--- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/sopt/confeti/api/user/controller/UserInfoController.java b/src/main/java/org/sopt/confeti/api/user/controller/UserInfoController.java index fae99c0..958c457 100644 --- a/src/main/java/org/sopt/confeti/api/user/controller/UserInfoController.java +++ b/src/main/java/org/sopt/confeti/api/user/controller/UserInfoController.java @@ -7,6 +7,7 @@ import org.sopt.confeti.global.common.BaseResponse; import org.sopt.confeti.global.message.SuccessMessage; import org.sopt.confeti.global.util.ApiResponseUtil; +import org.sopt.confeti.global.util.S3FileHandler; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestHeader; @@ -19,11 +20,11 @@ public class UserInfoController { private final UserInfoFacade userInfoFacade; + private final S3FileHandler s3FileHandler; @GetMapping - public ResponseEntity> getUserInfo(@RequestHeader("Authorization") Long userId) { + public ResponseEntity> getUserInfo(@RequestHeader("Authorization") long userId) { UserInfoDTO userInfo = userInfoFacade.getUserInfo(userId); - UserInfoResponse user = UserInfoResponse.from(userInfo); - return ApiResponseUtil.success(SuccessMessage.SUCCESS, user); + return ApiResponseUtil.success(SuccessMessage.SUCCESS, UserInfoResponse.of(userInfo, s3FileHandler)); } } diff --git a/src/main/java/org/sopt/confeti/api/user/dto/response/UserInfoResponse.java b/src/main/java/org/sopt/confeti/api/user/dto/response/UserInfoResponse.java index 7c87db1..4890fcb 100644 --- a/src/main/java/org/sopt/confeti/api/user/dto/response/UserInfoResponse.java +++ b/src/main/java/org/sopt/confeti/api/user/dto/response/UserInfoResponse.java @@ -1,13 +1,18 @@ package org.sopt.confeti.api.user.dto.response; import org.sopt.confeti.api.user.facade.dto.response.UserInfoDTO; +import org.sopt.confeti.global.util.S3FileHandler; public record UserInfoResponse ( Long userId, String profileUrl, String username ) { - public static UserInfoResponse from (UserInfoDTO userInfoDTO) { - return new UserInfoResponse(userInfoDTO.userId(), userInfoDTO.profileUrl(), userInfoDTO.username()); + public static UserInfoResponse of(final UserInfoDTO userInfoDTO, final S3FileHandler s3FileHandler) { + return new UserInfoResponse( + userInfoDTO.userId(), + s3FileHandler.getFileUrl(userInfoDTO.profilePath()), + userInfoDTO.username() + ); } } \ No newline at end of file diff --git a/src/main/java/org/sopt/confeti/api/user/facade/UserInfoFacade.java b/src/main/java/org/sopt/confeti/api/user/facade/UserInfoFacade.java index 00775c3..5c3a74e 100644 --- a/src/main/java/org/sopt/confeti/api/user/facade/UserInfoFacade.java +++ b/src/main/java/org/sopt/confeti/api/user/facade/UserInfoFacade.java @@ -14,7 +14,8 @@ public class UserInfoFacade { @Transactional public UserInfoDTO getUserInfo(Long userId) { - User user = userService.findById(userId); - return UserInfoDTO.from(user); + return UserInfoDTO.from( + userService.findById(userId) + ); } } diff --git a/src/main/java/org/sopt/confeti/api/user/facade/dto/response/UserInfoDTO.java b/src/main/java/org/sopt/confeti/api/user/facade/dto/response/UserInfoDTO.java index 34c73a3..8788558 100644 --- a/src/main/java/org/sopt/confeti/api/user/facade/dto/response/UserInfoDTO.java +++ b/src/main/java/org/sopt/confeti/api/user/facade/dto/response/UserInfoDTO.java @@ -2,8 +2,16 @@ import org.sopt.confeti.domain.user.User; -public record UserInfoDTO (Long userId, String profileUrl, String username){ - public static UserInfoDTO from (User user) { - return new UserInfoDTO(user.getId(), user.getProfilePath(), user.getUsername()); +public record UserInfoDTO ( + long userId, + String profilePath, + String username +){ + public static UserInfoDTO from (final User user) { + return new UserInfoDTO( + user.getId(), + user.getProfilePath(), + user.getUsername() + ); } } From 8c17fc50838a68910d6a7a835b35bd90a05f59af Mon Sep 17 00:00:00 2001 From: chyun Date: Thu, 23 Jan 2025 19:05:46 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix=20[#169]=20=ED=83=80=EC=9E=84=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EC=A1=B0=ED=9A=8C=20=EC=BF=BC=EB=A6=AC?= =?UTF-8?q?=EC=97=90=20@Param=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/repository/UserTimetableRepository.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java b/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java index 92d00eb..904930b 100644 --- a/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java +++ b/src/main/java/org/sopt/confeti/domain/usertimetable/infra/repository/UserTimetableRepository.java @@ -19,5 +19,8 @@ public interface UserTimetableRepository extends JpaRepository findByUserIdAndFestivalTimeIds(final long userId, final List festivalTimeIds); + List findByUserIdAndFestivalTimeIds( + final @Param("userId") long userId, + final @Param("festivalTimeIds") List festivalTimeIds + ); } From 7983a7709cabc6c1890c10e6269c79b0c766fefd Mon Sep 17 00:00:00 2001 From: chyun Date: Thu, 23 Jan 2025 19:17:45 +0900 Subject: [PATCH 5/5] =?UTF-8?q?fix=20[#169]=20userTimetableMapper=EC=97=90?= =?UTF-8?q?=20FestivalTimeId=EB=A5=BC=20=ED=82=A4=20=EA=B0=92=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../confeti/api/user/controller/UserTimetableController.java | 2 +- .../org/sopt/confeti/api/user/facade/UserTimetableFacade.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java b/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java index 4e57ad3..1aa7424 100644 --- a/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java +++ b/src/main/java/org/sopt/confeti/api/user/controller/UserTimetableController.java @@ -68,7 +68,7 @@ public ResponseEntity> removeTimetableFestival( @GetMapping("/{festivalDateId}") public ResponseEntity> getTimetableFestival( @RequestHeader("Authorization") long userId, - @PathVariable(name = "festivalDateId") @Min(value=0, message="요청 형식이 올바르지 않습니다.") long festivalDateId + @PathVariable(name = "festivalDateId") @Min(value = 0, message = "요청 형식이 올바르지 않습니다.") long festivalDateId ){ UserTimetableFestivalBasicDTO response = userTimetableFacade.getTimetableInfo(userId, festivalDateId); return ApiResponseUtil.success(SuccessMessage.SUCCESS, UserTimetableFestivalResponse.from(response)); diff --git a/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java b/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java index 0542646..fe2c05e 100644 --- a/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java +++ b/src/main/java/org/sopt/confeti/api/user/facade/UserTimetableFacade.java @@ -167,7 +167,9 @@ public UserTimetableFestivalBasicDTO getTimetableInfo(final long userId, final l List userTimetables = userTimetableService.getUserTimetables(userId, festivalTimeIds); Map userTimetableMapper = userTimetables.stream() - .collect(Collectors.toMap(UserTimetable::getId, Function.identity())); + .collect(Collectors.toMap(userTimetable -> + userTimetable.getFestivalTime().getId(), Function.identity()) + ); return UserTimetableFestivalBasicDTO.of(festivalDate, userTimetableMapper); }