Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 회원 세이프박스 값 조회 시 DTO 반환 #58

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading