-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…215) * Feat(#197): 이미 수락한 친구신청 오류 반환 로직 추가 (#197) * Feat(#197): 키워드로 조회할 때 이메일,이름으로 가능하도록 수정 (#197) * Feat: 친구 조회 로직 추가 (팀대시보드, 챌린지 정보는 아직 보류) * Test: 친구 조회 로직 추가 (팀대시보드, 챌린지 정보는 아직 보류) Test * Refactor: 개행 삭제 * Feat: 친구 마이페이지 public 개인 대시보드, 챌린지 목록 조회 추가 * Test: 친구 public 개인 대시보드와 챌린지 정보 조회 test 코드 작성 * Refactor: 파라미터로 넘어가는 memberId -> friendId로 변수명 변경
- Loading branch information
Showing
7 changed files
with
231 additions
and
10 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
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
13 changes: 13 additions & 0 deletions
13
...a/shop/kkeujeok/kkeujeokbackend/member/follow/exception/FollowAlreadyAcceptException.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,13 @@ | ||
package shop.kkeujeok.kkeujeokbackend.member.follow.exception; | ||
|
||
import shop.kkeujeok.kkeujeokbackend.global.error.exception.AccessDeniedGroupException; | ||
|
||
public class FollowAlreadyAcceptException extends AccessDeniedGroupException { | ||
public FollowAlreadyAcceptException(String message) { | ||
super(message); | ||
} | ||
|
||
public FollowAlreadyAcceptException() { | ||
this("이미 친구를 요청을 수락한 상태입니다."); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...kkeujeokbackend/member/mypage/api/dto/response/PersonalDashboardsAndChallengesResDto.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,18 @@ | ||
package shop.kkeujeok.kkeujeokbackend.member.mypage.api.dto.response; | ||
|
||
import shop.kkeujeok.kkeujeokbackend.challenge.api.dto.response.ChallengeListResDto; | ||
import shop.kkeujeok.kkeujeokbackend.dashboard.personal.api.dto.response.PersonalDashboardPageListResDto; | ||
import shop.kkeujeok.kkeujeokbackend.dashboard.team.api.dto.response.TeamDashboardListResDto; | ||
|
||
public record PersonalDashboardsAndChallengesResDto( | ||
PersonalDashboardPageListResDto personalDashboardList, | ||
ChallengeListResDto challengeList | ||
) { | ||
public static PersonalDashboardsAndChallengesResDto of(PersonalDashboardPageListResDto personalDashboardList, | ||
ChallengeListResDto challengeList) { | ||
return new PersonalDashboardsAndChallengesResDto( | ||
personalDashboardList, | ||
challengeList | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import shop.kkeujeok.kkeujeokbackend.member.domain.Role; | ||
import shop.kkeujeok.kkeujeokbackend.member.domain.SocialType; | ||
import shop.kkeujeok.kkeujeokbackend.member.mypage.api.dto.response.MyPageInfoResDto; | ||
import shop.kkeujeok.kkeujeokbackend.member.mypage.api.dto.response.PersonalDashboardsAndChallengesResDto; | ||
import shop.kkeujeok.kkeujeokbackend.member.mypage.api.dto.response.TeamDashboardsAndChallengesResDto; | ||
|
||
import java.util.ArrayList; | ||
|
@@ -211,4 +212,113 @@ void setUp(RestDocumentationContextProvider restDocumentation) { | |
// )) | ||
// .andExpect(status().isOk()); | ||
// } | ||
|
||
@DisplayName("친구의 프로필 정보를 가져옵니다.") | ||
@Test | ||
void 친구_프로필_정보를_가져옵니다() throws Exception { | ||
// Given | ||
Long friendId = 1L; | ||
MyPageInfoResDto friendProfileDto = new MyPageInfoResDto( | ||
"friendPicture", | ||
"[email protected]", | ||
"친구이름", | ||
"친구닉네임", | ||
SocialType.GOOGLE, | ||
"친구소개" | ||
); | ||
|
||
when(myPageService.findFriendProfile(friendId)).thenReturn(friendProfileDto); | ||
|
||
// When & Then | ||
mockMvc.perform(get("/api/members/mypage/{memberId}", friendId) | ||
.header("Authorization", "Bearer valid-token")) | ||
.andDo(print()) | ||
.andDo(document("member/friend-profile", | ||
preprocessRequest(prettyPrint()), | ||
preprocessResponse(prettyPrint()), | ||
responseFields( | ||
fieldWithPath("statusCode").description("상태 코드"), | ||
fieldWithPath("message").description("응답 메시지"), | ||
fieldWithPath("data.picture").description("친구 사진"), | ||
fieldWithPath("data.email").description("친구 이메일"), | ||
fieldWithPath("data.name").description("친구 이름"), | ||
fieldWithPath("data.nickName").description("친구 닉네임"), | ||
fieldWithPath("data.socialType").description("친구 소셜 타입"), | ||
fieldWithPath("data.introduction").description("친구 소개") | ||
) | ||
)) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.message", is("친구 프로필 정보 조회"))) | ||
.andExpect(jsonPath("$.data").exists()) | ||
.andExpect(jsonPath("$.data.email", is("[email protected]"))) | ||
.andExpect(jsonPath("$.data.name", is("친구이름"))) | ||
.andExpect(jsonPath("$.data.nickName", is("친구닉네임"))) | ||
.andExpect(jsonPath("$.data.socialType", is(SocialType.GOOGLE.name()))) | ||
.andExpect(jsonPath("$.data.introduction", is("친구소개"))); | ||
} | ||
|
||
@DisplayName("친구의 public 개인 대시보드와 챌린지 정보를 가져옵니다.") | ||
@Test | ||
void 친구_대시보드와_챌린지_정보를_가져옵니다() throws Exception { | ||
// Given | ||
PersonalDashboardPageListResDto personalDashboardList = new PersonalDashboardPageListResDto( | ||
new ArrayList<>(), | ||
new PageInfoResDto(0, 0, 0) | ||
); | ||
|
||
ChallengeListResDto challengeList = new ChallengeListResDto( | ||
new ArrayList<>(), | ||
new PageInfoResDto(0, 0, 0) | ||
); | ||
|
||
PersonalDashboardsAndChallengesResDto resDto = new PersonalDashboardsAndChallengesResDto( | ||
personalDashboardList, | ||
challengeList | ||
); | ||
|
||
Long friendId = 1L; | ||
|
||
when(myPageService.findFriendDashboardsAndChallenges(friendId, PageRequest.of(0, 10))).thenReturn(resDto); | ||
|
||
// When & Then | ||
mockMvc.perform(get("/api/members/mypage/{memberId}/dashboard-challenges", friendId) | ||
.param("page", "0") | ||
.param("size", "10")) | ||
.andDo(print()) | ||
.andDo(document("member/friend-dashboard-challenges", | ||
preprocessRequest(prettyPrint()), | ||
preprocessResponse(prettyPrint()), | ||
queryParameters( | ||
parameterWithName("page").description("페이지 번호 (기본값: 0)"), | ||
parameterWithName("size").description("페이지 당 항목 수 (기본값: 10)") | ||
), | ||
responseFields( | ||
fieldWithPath("statusCode").description("상태 코드"), | ||
fieldWithPath("message").description("응답 메시지"), | ||
fieldWithPath("data.personalDashboardList.personalDashboardInfoResDto").description("개인 대시보드 정보 목록"), | ||
fieldWithPath("data.personalDashboardList.pageInfoResDto.currentPage").description("현재 페이지 번호"), | ||
fieldWithPath("data.personalDashboardList.pageInfoResDto.totalPages").description("총 페이지 수"), | ||
fieldWithPath("data.personalDashboardList.pageInfoResDto.totalItems").description("총 항목 수"), | ||
fieldWithPath("data.challengeList.challengeInfoResDto").description("챌린지 정보 목록"), | ||
fieldWithPath("data.challengeList.pageInfoResDto.currentPage").description("현재 페이지 번호"), | ||
fieldWithPath("data.challengeList.pageInfoResDto.totalPages").description("총 페이지 수"), | ||
fieldWithPath("data.challengeList.pageInfoResDto.totalItems").description("총 항목 수") | ||
) | ||
)) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.statusCode", is(200))) | ||
.andExpect(jsonPath("$.message", is("대시보드와 챌린지 정보 조회"))) | ||
.andExpect(jsonPath("$.data").exists()) | ||
.andExpect(jsonPath("$.data.personalDashboardList").exists()) | ||
.andExpect(jsonPath("$.data.personalDashboardList.personalDashboardInfoResDto").isArray()) | ||
.andExpect(jsonPath("$.data.personalDashboardList.pageInfoResDto.currentPage", is(0))) | ||
.andExpect(jsonPath("$.data.personalDashboardList.pageInfoResDto.totalPages", is(0))) | ||
.andExpect(jsonPath("$.data.personalDashboardList.pageInfoResDto.totalItems", is(0))) | ||
.andExpect(jsonPath("$.data.challengeList").exists()) | ||
.andExpect(jsonPath("$.data.challengeList.challengeInfoResDto").isArray()) | ||
.andExpect(jsonPath("$.data.challengeList.pageInfoResDto.currentPage", is(0))) | ||
.andExpect(jsonPath("$.data.challengeList.pageInfoResDto.totalPages", is(0))) | ||
.andExpect(jsonPath("$.data.challengeList.pageInfoResDto.totalItems", is(0))); | ||
} | ||
|
||
} |