Skip to content

Commit

Permalink
[FIX] 회원 세이프박스 값 조회 시 DTO 반환
Browse files Browse the repository at this point in the history
  • Loading branch information
hcg0127 committed Aug 15, 2024
1 parent cd4b28a commit 494ec95
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/main/java/umc/haruchi/converter/MemberConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ public static Member toMember(MemberRequestDTO.MemberJoinDTO request) {
public static MemberResponseDTO.MemberJoinResultDTO toJoinResultDTO(Member member) {
return MemberResponseDTO.MemberJoinResultDTO.builder()
.memberId(member.getId())
.createdAt(LocalDateTime.now()).build();
.createdAt(LocalDateTime.now())
.build();
}

public static MemberResponseDTO.MemberSafeBoxResultDTO toSafeBoxResultDTO(Long safeBox) {
return MemberResponseDTO.MemberSafeBoxResultDTO.builder()
.safeBox(safeBox)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public ApiResponse<MemberResponseDTO.MemberDetailResultDTO> getMemberDetail(@Aut

@GetMapping("/safebox")
@Operation(summary = "회원 세이프박스 조회 API", description = "헤더에 있는 토큰으로 회원을 식별하고, 회원의 세이프박스 금액 조회하는 API")
public ApiResponse<Long> getMemberSafeBox(@AuthenticationPrincipal MemberDetail memberDetail) {
return ApiResponse.onSuccess(memberDetail.getMember().getSafeBox());
public ApiResponse<MemberResponseDTO.MemberSafeBoxResultDTO> getMemberSafeBox(@AuthenticationPrincipal MemberDetail memberDetail) {
Long safeBox = memberDetail.getMember().getSafeBox();
return ApiResponse.onSuccess(MemberConverter.toSafeBoxResultDTO(safeBox));
}
}
8 changes: 8 additions & 0 deletions src/main/java/umc/haruchi/web/dto/MemberResponseDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,12 @@ public static class MemberDetailResultDTO {
String email;
String name;
}

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class MemberSafeBoxResultDTO {
Long safeBox;
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spring:

data:
redis:
host: ${AWS_REDIS_HOST} #로컬로 실행할 때에는 로컬 Redis 서버로만 테스트 가능. 연동 x
host: localhost #${AWS_REDIS_HOST} #로컬로 실행할 때에는 로컬 Redis 서버로만 테스트 가능. 연동 x
port: 6379

cache:
Expand Down

0 comments on commit 494ec95

Please sign in to comment.