-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: PeopleController에서 내 피플과 내 피플 프로필 기능을 분리 (#71)
- Loading branch information
Showing
44 changed files
with
733 additions
and
422 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#Tue Jul 09 18:32:55 KST 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
1 change: 1 addition & 0 deletions
1
src/docs/asciidoc/my-people-profile/create-my-people-profile.adoc
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 @@ | ||
operation::/create-my-people-profile/create-my-people-profile[snippets="http-request,request-headers,request-fields,http-response"] |
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 @@ | ||
operation::/get-my-people-profile/get-my-people-profile[snippets="http-request,request-headers,http-response,response-fields-data"] |
1 change: 1 addition & 0 deletions
1
src/docs/asciidoc/my-people-profile/update-my-people-profile.adoc
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 @@ | ||
operation::/update-my-people-profile/update-my-people-profile[snippets="http-request,request-headers,request-fields,http-response"] |
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 @@ | ||
operation::/create-my-people/create-my-people[snippets="http-request,request-headers,request-fields,http-response"] |
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 @@ | ||
operation::/get-my-people/get-my-people[snippets="http-request,request-headers,http-response,response-fields-data"] |
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 @@ | ||
operation::/update-my-people/update-my-people[snippets="http-request,request-headers,request-fields,http-response"] |
This file was deleted.
Oops, something went wrong.
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
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
74 changes: 74 additions & 0 deletions
74
src/main/java/es/princip/getp/domain/people/controller/MyPeopleProfileController.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,74 @@ | ||
package es.princip.getp.domain.people.controller; | ||
|
||
import es.princip.getp.domain.member.domain.entity.Member; | ||
import es.princip.getp.domain.people.dto.request.CreatePeopleProfileRequest; | ||
import es.princip.getp.domain.people.dto.request.UpdatePeopleProfileRequest; | ||
import es.princip.getp.domain.people.dto.response.peopleProfile.DetailPeopleProfileResponse; | ||
import es.princip.getp.domain.people.service.PeopleProfileService; | ||
import es.princip.getp.global.security.details.PrincipalDetails; | ||
import es.princip.getp.global.util.ApiResponse; | ||
import es.princip.getp.global.util.ApiResponse.ApiSuccessResult; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/people/me/profile") | ||
@RequiredArgsConstructor | ||
public class MyPeopleProfileController { | ||
|
||
private final PeopleProfileService peopleProfileService; | ||
|
||
/** | ||
* 내 피플 프로필 등록 | ||
* | ||
* @param request 등록할 피플 프로필 정보 | ||
* @return 등록된 피플 프로필 정보 | ||
*/ | ||
@PostMapping | ||
@PreAuthorize("hasRole('PEOPLE') and isAuthenticated()") | ||
public ResponseEntity<ApiSuccessResult<?>> createMyPeopleProfile( | ||
@RequestBody @Valid CreatePeopleProfileRequest request, | ||
@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
Member member = principalDetails.getMember(); | ||
peopleProfileService.create(member.getMemberId(), request); | ||
return ResponseEntity.status(HttpStatus.CREATED) | ||
.body(ApiResponse.success(HttpStatus.CREATED)); | ||
} | ||
|
||
/** | ||
* 내 피플 프로필 조회 | ||
* | ||
* @return 내 피플 프로필 정보 | ||
*/ | ||
@GetMapping | ||
@PreAuthorize("hasRole('PEOPLE') and isAuthenticated()") | ||
public ResponseEntity<ApiSuccessResult<DetailPeopleProfileResponse>> getMyPeopleProfile( | ||
@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
Member member = principalDetails.getMember(); | ||
DetailPeopleProfileResponse response = DetailPeopleProfileResponse.from(peopleProfileService.getByMemberId(member.getMemberId())); | ||
return ResponseEntity.ok() | ||
.body(ApiResponse.success(HttpStatus.OK, response)); | ||
} | ||
|
||
/** | ||
* 내 피플 프로필 수정 | ||
* | ||
* @param request 수정할 피플 프로필 정보 | ||
* @return 수정된 피플 프로필 정보 | ||
*/ | ||
@PutMapping | ||
@PreAuthorize("hasRole('PEOPLE') and isAuthenticated()") | ||
public ResponseEntity<ApiSuccessResult<?>> updateMyPeopleProfile( | ||
@RequestBody @Valid UpdatePeopleProfileRequest request, | ||
@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
Member member = principalDetails.getMember(); | ||
peopleProfileService.update(member.getMemberId(), request); | ||
return ResponseEntity.status(HttpStatus.CREATED) | ||
.body(ApiResponse.success(HttpStatus.CREATED)); | ||
} | ||
} |
Oops, something went wrong.