Skip to content

Commit

Permalink
[feat #80] 프로필 조회 응답 DTO 필드 추가 (#81)
Browse files Browse the repository at this point in the history
* [style] : 코드 포맷팅

* [feat] : 프로필 조회 응답 DTO memberId, profileImageNO 필드 추가

* [test] : 프로필 조회 응답 DTO 필드 추가에 따른 테스트 코드 수정
  • Loading branch information
dudxo authored Aug 23, 2024
1 parent b4e69c8 commit 66d702c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/dnd/gongmuin/member/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Member extends TimeBaseEntity {
private int credit;
@Column(name = "role", nullable = false)
private String role;
@Column(name = "profile_image_no", nullable = false)
@Column(name = "profile_image_no", nullable = false)
private final int profileImageNo = setRandomNumber();

@Builder(access = PRIVATE)
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/dnd/gongmuin/member/dto/MemberMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ public class MemberMapper {

public static MemberProfileResponse toMemberProfileResponse(Member member) {
return new MemberProfileResponse(
member.getId(),
member.getNickname(),
member.getJobGroup().getLabel(),
member.getJobCategory().getLabel(),
member.getCredit()
member.getCredit(),
member.getProfileImageNo()
);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.dnd.gongmuin.member.dto.response;

public record MemberProfileResponse(
Long memberId,
String nickname,
String jobGroup,
String jobCategory,
int credit
int credit,
int profileImageNo
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ void getMemberProfile() throws Exception {
.cookie(accessToken)
)
.andExpect(status().isOk())
.andExpect(jsonPath("nickname").value("김회원"))
.andExpect(jsonPath("jobGroup").value("공업"))
.andExpect(jsonPath("jobCategory").value("기계"))
.andExpect(jsonPath("memberId").value(loginMember.getId()))
.andExpect(jsonPath("nickname").value(loginMember.getNickname()))
.andExpect(jsonPath("jobGroup").value(loginMember.getJobGroup().getLabel()))
.andExpect(jsonPath("jobCategory").value(loginMember.getJobCategory().getLabel()))
.andExpect(jsonPath("profileImageNo").value(loginMember.getProfileImageNo()))
.andExpect(jsonPath("credit").value(10000));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ void getMemberProfile() {

// then
assertAll(
() -> assertThat(memberProfile.memberId()).isEqualTo(member.getId()),
() -> assertThat(memberProfile.nickname()).isEqualTo(member.getNickname()),
() -> assertThat(memberProfile.jobGroup()).isEqualTo(member.getJobGroup().getLabel()),
() -> assertThat(memberProfile.jobCategory()).isEqualTo(member.getJobCategory().getLabel()),
() -> assertThat(memberProfile.credit()).isEqualTo(member.getCredit())
() -> assertThat(memberProfile.credit()).isEqualTo(member.getCredit()),
() -> assertThat(memberProfile.profileImageNo()).isEqualTo(member.getProfileImageNo())
);
}

Expand Down

0 comments on commit 66d702c

Please sign in to comment.