-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 멤버 정보 변경 API 작성 * feat: 멤버 정보 변경 API 작성 * chore: http method patch로 변경
- Loading branch information
Showing
8 changed files
with
111 additions
and
12 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
layer-api/src/main/java/org/layer/domain/member/controller/MemberApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.layer.domain.member.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import org.layer.common.annotation.MemberId; | ||
import org.layer.domain.form.controller.dto.response.FormGetResponse; | ||
import org.layer.domain.member.controller.dto.UpdateMemberInfoRequest; | ||
import org.layer.domain.member.controller.dto.UpdateMemberInfoResponse; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
@Tag(name = "회원 서비스", description = "회원 관련 api") | ||
public interface MemberApi { | ||
@Operation(summary = "회원 정보(이름, 프로필 사진) 수정", method = "POST", description = "회원의 이름과 프로필 사진(url)을 수정합니다.") | ||
ResponseEntity<UpdateMemberInfoResponse> updateMemberInfo(@MemberId Long memberId, @Valid UpdateMemberInfoRequest updateMemberInfoRequest); | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
layer-api/src/main/java/org/layer/domain/member/controller/MemberController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.layer.domain.member.controller; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.layer.common.annotation.MemberId; | ||
import org.layer.domain.member.controller.dto.UpdateMemberInfoRequest; | ||
import org.layer.domain.member.controller.dto.UpdateMemberInfoResponse; | ||
import org.layer.domain.member.service.MemberService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RequestMapping("/api/member") | ||
@RequiredArgsConstructor | ||
@RestController | ||
public class MemberController implements MemberApi { | ||
private final MemberService memberService; | ||
|
||
@Override | ||
@PatchMapping("/update-profile") | ||
public ResponseEntity<UpdateMemberInfoResponse> updateMemberInfo(@MemberId Long memberId, @Valid @RequestBody UpdateMemberInfoRequest updateMemberInfoRequest) { | ||
UpdateMemberInfoResponse response = memberService.updateMemberInfo(memberId, updateMemberInfoRequest); | ||
|
||
return new ResponseEntity<>(response, HttpStatus.OK); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
layer-api/src/main/java/org/layer/domain/member/controller/dto/UpdateMemberInfoRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.layer.domain.member.controller.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
@Schema(description = "변경할 회원 정보") | ||
public record UpdateMemberInfoRequest(@NotNull | ||
@Schema(description = "변경할 이름") | ||
String name, | ||
@Schema(description = "변경할 이미지 url") | ||
String profileImageUrl) { | ||
} |
16 changes: 16 additions & 0 deletions
16
layer-api/src/main/java/org/layer/domain/member/controller/dto/UpdateMemberInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.layer.domain.member.controller.dto; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
@Schema(description = "정보가 변경된 회원") | ||
public record UpdateMemberInfoResponse(@NotNull | ||
@Schema(description = "정보가 변경된 회원 ID") | ||
Long memberId, | ||
@NotNull | ||
@Schema(description = "변경된 이름") | ||
String name, | ||
@Schema(description = "변경된 이미지 url") | ||
String profileImageUrl) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters