Skip to content

Commit

Permalink
feat: add updateMember mock api
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji-soo708 committed Dec 14, 2023
1 parent 095c71b commit 6a6c17f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
21 changes: 15 additions & 6 deletions member/src/main/java/com/oing/controller/MemberController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.oing.controller;

import com.oing.domain.exception.DomainException;
import com.oing.domain.exception.ErrorCode;
import com.oing.dto.request.UpdateMemberRequest;
import com.oing.dto.response.FamilyMemberProfileResponse;
import com.oing.dto.response.MemberResponse;
Expand Down Expand Up @@ -48,11 +50,18 @@ public MemberResponse getMember(String memberId) {

@Override
public MemberResponse updateMember(String memberId, UpdateMemberRequest request) {
//TODO: 프로필 이미지 수정 로직 추가
return new MemberResponse(
memberId,
request.name(),
request.profileImageUrl()
);
String memberIdBase = "01HGW2N7EHJVJ4CJ999RRS2E";
memberId = "01HGW2N7EHJVJ4CJ999RRS2E";

//TODO: 로그인한 사용자의 ID와 정보수정 대상 사용자의 ID가 같은지 확인
if (memberIdBase.equals(memberId)) {
//TODO: 프로필 이미지 및 닉네임 수정 로직 추가
return new MemberResponse(
memberId,
request.name(),
request.profileImageUrl()
);
}
throw new DomainException(ErrorCode.AUTHORIZATION_FAILED);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.oing.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

@Schema(description = "회원 정보 수정 요청")
public record UpdateMemberRequest(
@NotBlank
@Size(min = 1, max = 10)
@Schema(description = "회원 이름", example = "홍길동")
String name,

Expand Down
1 change: 1 addition & 0 deletions member/src/main/java/com/oing/restapi/MemberApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ MemberResponse updateMember(
@PathVariable
String memberId,

@Valid
@RequestBody
UpdateMemberRequest request
);
Expand Down

0 comments on commit 6a6c17f

Please sign in to comment.