Skip to content

Commit fc737f7

Browse files
authored
�[BUG] 상대방 프로필 조회 api의 url 수정 + 포트폴리오 조회를 타인 포폴까지 조회하도록 수정 (#207)
* 마이페이지 응답값 추가 * PathVaraiable userId를 URL 에 추가 * 포트폴리오 목록 조회에 userId를 통해서 상대방의 포트폴리오도 조회가능하게 수정했습니다
1 parent 452d14a commit fc737f7

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

src/main/java/com/brainpix/profile/controller/PortfolioController.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,16 @@ public ResponseEntity<ApiResponse<Void>> deletePortfolio(
7979
}
8080

8181
@AllUser
82-
@Operation(summary = "내 포트폴리오 목록 조회", description = "사용자 ID를 기준으로 포트폴리오 목록을 페이징 처리하여 조회합니다.")
83-
@GetMapping
82+
@Operation(summary = "사용자의 포트폴리오 목록 조회",
83+
description = "특정 사용자의 포트폴리오 목록을 조회합니다. 자신의 포트폴리오를 조회하려면 자신의 userId를 전달하세요.")
84+
@GetMapping("/{userId}")
8485
@SwaggerPageable
85-
public ResponseEntity<CommonPageResponse<PortfolioResponse>> findMyPortfolios(
86-
@UserId Long userId,
86+
public ResponseEntity<CommonPageResponse<PortfolioResponse>> findPortfolios(
87+
@PathVariable Long userId,
8788
@PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable
8889
) {
89-
Page<PortfolioResponse> page = portfolioService.findAllMyPortfolios(userId, pageable);
90-
90+
Page<PortfolioResponse> page = portfolioService.findAllPortfoliosByUserId(userId, pageable);
9191
CommonPageResponse<PortfolioResponse> response = CommonPageResponse.of(page);
92-
9392
return ResponseEntity.ok(response);
9493
}
9594

src/main/java/com/brainpix/profile/controller/PublicProfileController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class PublicProfileController {
3535
*/
3636
@AllUser
3737
@Operation(summary = "개인 공개 프로필 조회", description = "특정 사용자에게 공개 개인 프로필을 조회합니다.")
38-
@GetMapping("/individual")
38+
@GetMapping("/individual/{userId}")
3939
public ResponseEntity<ApiResponse<IndividualProfileResponseDto>> getPublicIndividualProfile(
4040
@PathVariable Long userId) {
4141
IndividualProfileResponseDto profile = publicProfileService.getPublicIndividualProfile(userId);
@@ -47,15 +47,15 @@ public ResponseEntity<ApiResponse<IndividualProfileResponseDto>> getPublicIndivi
4747
*/
4848
@AllUser
4949
@Operation(summary = "기업 공개 프로필 조회", description = "특정 사용자에게 공개 기업 프로필을 조회합니다.")
50-
@GetMapping("/company")
50+
@GetMapping("/company/{userId}")
5151
public ResponseEntity<ApiResponse<CompanyProfileResponseDto>> getPublicCompanyProfile(@PathVariable Long userId) {
5252
CompanyProfileResponseDto profile = publicProfileService.getPublicCompanyProfile(userId);
5353
return ResponseEntity.ok(ApiResponse.success(profile));
5454
}
5555

5656
@AllUser
5757
@Operation(summary = "사용자 게시글 조회", description = "특정 사용자가 작성한 공개 게시글을 조회합니다.")
58-
@GetMapping
58+
@GetMapping("/{userId}")
5959
@SwaggerPageable
6060
public ResponseEntity<ApiResponse<CommonPageResponse<PublicProfileResponseDto.PostPreviewDto>>> getPostsByUser(
6161
@PathVariable Long userId,

src/main/java/com/brainpix/profile/dto/MyPageResponseDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ public class MyPageResponseDto {
1717
private long collaborationCount; // 협업 경험 횟수
1818
private String selfIntroduction; // 자기소개
1919
private String profileImage;
20+
private Long userId;
2021
}

src/main/java/com/brainpix/profile/service/MyPageService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public MyPageResponseDto getMyPage(Long userId) {
5757
.collaborationCount(collaborationCount)
5858
.selfIntroduction(selfIntroduction)
5959
.profileImage(user.getProfileImage())
60+
.userId(userId)
6061
.build();
6162
}
6263

src/main/java/com/brainpix/profile/service/PortfolioService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void deletePortfolio(long userId, long portfolioId) {
6767
portfolioRepository.delete(portfolio);
6868
}
6969

70-
public Page<PortfolioResponse> findAllMyPortfolios(long userId, Pageable pageable) {
70+
public Page<PortfolioResponse> findAllPortfoliosByUserId(Long userId, Pageable pageable) {
7171
User user = userRepository.findById(userId)
7272
.orElseThrow(() -> new BrainPixException(CommonErrorCode.USER_NOT_FOUND));
7373

0 commit comments

Comments
 (0)