Skip to content

Commit

Permalink
Refactor: 마이페이지 관련 기능 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhacandy authored Aug 21, 2024
2 parents 0beec29 + 99e138e commit 728be7b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class MemberController {

private final MemberService memberService;

@Operation(summary = "기본 정보 수정", description = "정보 업데이트 중 기본 정보 수정을 위한 메소드")
@Operation(summary = "기본 정보 (소속, 직업, 학력, 스킬, 이력 및 활동, 수상내역, 어학성적) 등록 및 수정", description = "정보 업데이트 중 기본 정보 (소속, 직업, 학력, 스킬, 이력 및 활동, 수상내역, 어학성적) 수정을 위한 메소드")
@ApiResponse(content = @Content(schema = @Schema(implementation = Response.class)))
@PatchMapping("/update-default-info")
@PostMapping("/default-info")
@ResponseStatus(HttpStatus.OK)
public Response<?> registerPost(@Valid @RequestBody UpdateDefaultInfoRequest request,
@AuthenticationPrincipal Long memberId) {
Expand All @@ -55,7 +55,7 @@ public Response<?> updateProfileShowing(@Valid @RequestBody UpdateMemberProfileS
return Response.createSuccessWithNoData("[마이페이지] 프로필 공개 여부 설정");
}

@Operation(summary = "추가 정보 등록", description = "정보 업데이트 중 추가 정보 등록을 위한 메소드")
@Operation(summary = "추가 정보 (경력, 수상 내역) 등록 및 수정", description = "정보 업데이트 중 추가 정보 등록을 위한 메소드")
@ApiResponse(content = @Content(schema = @Schema(implementation = Response.class)))
@PostMapping("/additional-info")
@ResponseStatus(HttpStatus.OK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,19 @@ public void updateRole(MemberRole memberRole) {
this.memberRole = memberRole;
}

public void updateDefaultInfo(String field, String belong, MemberJob job) {
public void updateDefaultInfo(String field, String belong, MemberJob job, String educationBackground, String skill, String activityHistory, String award,
String languageScore) {
this.field = field;
this.belong = belong;
this.job = job;
this.educationBackground = educationBackground;
this.skill = skill;
this.activityHistory = activityHistory;
this.award = award;
this.languageScore = languageScore;
}

public void updateAdditionalInfo(String educationBackground, String skill, String activityHistory, String award,
String languageScore, String career, String aboutMe) {
public void updateAdditionalInfo(String career, String aboutMe) {
this.educationBackground = educationBackground;
this.skill = skill;
this.activityHistory = activityHistory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

public record AdditionalInfoRequest(

String educationBackground,

String skill,

String activityHistory,

String award,

String languageScore,

String career,

String aboutMe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ public record UpdateDefaultInfoRequest (
String belong,

@NotNull
MemberJob job
MemberJob job,

String educationBackground,

String skill,

String activityHistory,

String award,

String languageScore,

String career,

String aboutMe
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import cotato.growingpain.member.domain.entity.Member;

public record MemberInfoResponse(
String name,
String field,
String belong,
MemberJob job,
Expand All @@ -17,6 +18,7 @@ public record MemberInfoResponse(
) {
public static MemberInfoResponse fromMember(Member member) {
return new MemberInfoResponse(
member.getName(),
member.getField(),
member.getBelong(),
member.getJob(),
Expand All @@ -32,6 +34,7 @@ public static MemberInfoResponse fromMember(Member member) {

public static MemberInfoResponse defaultInfoFromMember(Member member) {
return new MemberInfoResponse(
member.getName(),
member.getField(),
member.getBelong(),
member.getJob(),
Expand Down
16 changes: 10 additions & 6 deletions src/main/java/cotato/growingpain/member/service/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ public void updateDefaultInfo(UpdateDefaultInfoRequest request, Long memberId) {
Member member = memberRepository.findById(memberId)
.orElseThrow(()->new AppException(ErrorCode.MEMBER_NOT_FOUND));

member.updateDefaultInfo(request.field(), request.belong(), request.job());
member.updateDefaultInfo(
request.field(),
request.belong(),
request.job(),
request.educationBackground(),
request.skill(),
request.activityHistory(),
request.award(),
request.languageScore()
);
memberRepository.save(member);
}

Expand All @@ -35,11 +44,6 @@ public void registerAdditionalInfo(AdditionalInfoRequest request, Long memberId)
.orElseThrow(()->new AppException(ErrorCode.MEMBER_NOT_FOUND));

member.updateAdditionalInfo(
request.educationBackground(),
request.skill(),
request.activityHistory(),
request.award(),
request.languageScore(),
request.career(),
request.aboutMe()
);
Expand Down

0 comments on commit 728be7b

Please sign in to comment.