Skip to content

Commit

Permalink
Merge pull request #48 from soma-lighthouse/enhance/filtering-LH-197
Browse files Browse the repository at this point in the history
[LH-197] patch api 수정 (#43)
  • Loading branch information
hyeonjun-An authored Sep 25, 2023
2 parents eac403f + 6aa9e00 commit e2f0859
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/lighthouse/lingoswap/member/entity/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public int calculateAge() {
}

public void updateMember(LocalDate birthday, String name, String description, String profileImageUri, Gender gender, Country region) {
this.birthday = birthday;
this.name = name;
this.description = description;
this.profileImageUri = profileImageUri;
this.gender = gender;
this.region = region;
if (birthday != null) this.birthday = birthday;
if (name != null) this.name = name;
if (description != null) this.description = description;
if (profileImageUri != null) this.profileImageUri = profileImageUri;
if (gender != null) this.gender = gender;
if (region != null) this.region = region;
}

public void patchDescription(String description) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,13 @@ public ResponseDto<LanguageFormResponse> readLanguageForm() {

public ResponseDto<Object> patch(final String uuid, final MemberRequest memberRequest) {
Member member = memberService.findByUuid(uuid);
member.updateMember(memberRequest.birthday(), memberRequest.name(), memberRequest.description(), memberRequest.profileImageUri(),
memberRequest.gender(), countryService.findCountryByCode(memberRequest.region()));
if (memberRequest.region() == null) {
member.updateMember(memberRequest.birthday(), memberRequest.name(), memberRequest.description(), memberRequest.profileImageUri(),
memberRequest.gender(), null);
} else {
member.updateMember(memberRequest.birthday(), memberRequest.name(), memberRequest.description(), memberRequest.profileImageUri(),
memberRequest.gender(), countryService.findCountryByCode(memberRequest.region()));
}
memberService.save(member);
return ResponseDto.success(null);
}
Expand Down

0 comments on commit e2f0859

Please sign in to comment.