Skip to content

Commit

Permalink
Merge pull request #51 from Modagbul/feat/mission
Browse files Browse the repository at this point in the history
fix : 미션 인증물 타입 리턴값 추가 및 나의 성공 횟수 조회 adoc 작성
  • Loading branch information
seungueonn authored Nov 2, 2023
2 parents 9dc3a07 + 7d12468 commit d39f97f
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/docs/asciidoc/MissionArchive-API.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ operation::mission-archive-controller-test/인증_성공_인원_조회[snippets=

---

[[MissionArchive-나의성공횟수조회]]
== 나의 성공 횟수 조회 ( n/n번 )
operation::mission-archive-controller-test/나의_성공_횟수_조회[snippets='http-request,path-parameters,http-response,response-fields']

---

[[MissionArchive-미션인증물좋아요]]
== 미션 인증물 좋아요
operation::mission-archive-controller-test/미션_인증물_좋아요[snippets='http-request,path-parameters,request-fields,http-response,response-fields']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ public class MissionArchiveRes {

private Long archiveId;
private String archive;
private String way;
private String createdDate;
private String status;
private Long count;
private String heartStatus;
private Long hearts;

public void updateHeartStatus(boolean status) {
if (status) {
this.heartStatus = "True";
}else{
this.heartStatus = "False";
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class PersonalArchiveRes {

private String archive;
private String createdDate;
private String way;

private String heartStatus;
private int hearts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static MissionArchiveRes mapToMissionArchiveRes(MissionArchive missionArc
return MissionArchiveRes.builder()
.archiveId(missionArchive.getId())
.archive(missionArchive.getArchive())
.way(missionArchive.getMission().getWay().toString())
.createdDate(missionArchive.getCreatedDate().toString())
.status(missionArchive.getStatus().name())
.count(missionArchive.getCount())
Expand Down Expand Up @@ -64,6 +65,7 @@ public static PersonalArchiveRes mapToPersonalArchive(MissionArchive missionArch
.nickname(member.getNickName())
.profileImg(member.getProfileImage())
.archive(missionArchive.getArchive())
.way(missionArchive.getMission().getWay().toString())
.createdDate(missionArchive.getCreatedDate().toString())
.status(missionArchive.getStatus().name())
.count(missionArchive.getCount())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ public Optional<List<MissionArchive>> findOthersArchives(Long memberId, Long mis
@Override
public Optional<Long> findDonePeopleByMissionId(Long missionId) {
return Optional.ofNullable(queryFactory
.select(missionArchive.count())
.select(missionArchive.member.count())
.from(missionArchive)
.where(
missionArchive.mission.id.eq(missionId)
)
.groupBy(missionArchive.member)
.fetchFirst()

);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
.archiveId(1L)
.archive("content[s3 Link / text / link]")
.createdDate("2023-09-03T21:32:33.888")
.way("TEXT/LINK/PHOTO")
.status("COMPLETE/SKIP")
.count(1L)
.heartStatus("[True/False]")
Expand Down Expand Up @@ -99,6 +100,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
fieldWithPath("message").description("미션 인증을 완료 했습니다."),
fieldWithPath("data.archiveId").description("미션 인증 아이디"),
fieldWithPath("data.archive").description("미션 인증물 [s3URL/text/링크]"),
fieldWithPath("data.way").description("미션 인증물 방식"),
fieldWithPath("data.createdDate").description("미션 제출 시각"),
fieldWithPath("data.status").description("미션 인증 상태"),
fieldWithPath("data.count").description("미션 인증 횟수"),
Expand All @@ -124,6 +126,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
MissionArchiveRes output = MissionArchiveRes.builder()
.archiveId(1L)
.archive("content[s3 Link / text / link]")
.way("TEXT/LINK/PHOTO")
.createdDate("2023-09-03T21:32:33.888")
.status("COMPLETE/SKIP")
.count(1L)
Expand Down Expand Up @@ -164,6 +167,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
fieldWithPath("message").description(UPDATE_ARCHIVE_SUCCESS),
fieldWithPath("data.archiveId").description("미션 인증 아이디"),
fieldWithPath("data.archive").description("미션 인증물 [s3URL/text/링크]"),
fieldWithPath("data.way").description("미션 인증물 방식"),
fieldWithPath("data.createdDate").description("미션 제출 시각"),
fieldWithPath("data.hearts").description("미션 인증 좋아요 수"),
fieldWithPath("data.status").description("미션 인증 상태"),
Expand All @@ -184,6 +188,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
List<MissionArchiveRes> output = Lists.newArrayList(MissionArchiveRes.builder()
.archiveId(1L)
.archive("content[s3 Link / text / link]")
.way("TEXT/LINK/PHOTO")
.createdDate("2023-09-03T21:32:33.888")
.status("COMPLETE/SKIP")
.count(1L)
Expand Down Expand Up @@ -220,6 +225,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
fieldWithPath("message").description(READ_MY_ARCHIVE_SUCCESS.getMessage()),
fieldWithPath("data[].archiveId").description("미션 인증 아이디"),
fieldWithPath("data[].archive").description("미션 인증물 [s3URL/text/링크]"),
fieldWithPath("data[].way").description("미션 인증물 방식"),
fieldWithPath("data[].createdDate").description("미션 제출 시각"),
fieldWithPath("data[].status").description("미션 인증 상태"),
fieldWithPath("data[].count").description("미션 인증 횟수"),
Expand All @@ -243,6 +249,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
.nickname("modagbul_tester1")
.profileImg("[s3 Link]")
.archive("content[s3 Link / text / link]")
.way("TEXT/LINK/PHOTO")
.createdDate("2023-09-03T21:32:33.888")
.status("COMPLETE/SKIP")
.count(1L)
Expand Down Expand Up @@ -281,6 +288,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
fieldWithPath("data[].nickname").description("미션 인증자 닉네임 "),
fieldWithPath("data[].profileImg").description("미션 인증자 프로필 이미지 "),
fieldWithPath("data[].archive").description("미션 인증물 [s3URL/text/링크] "),
fieldWithPath("data[].way").description("미션 인증물 방식 "),
fieldWithPath("data[].createdDate").description("미션 인증 날짜 "),
fieldWithPath("data[].status").description("미션 인증 상태"),
fieldWithPath("data[].count").description("미션 인증 횟수"),
Expand Down Expand Up @@ -339,6 +347,51 @@ public class MissionArchiveControllerTest extends CommonControllerTest {
)
.andReturn();

}
@Test
public void 나의_성공_횟수_조회() throws Exception {
//given

MissionArchiveStatusRes output = MissionArchiveStatusRes.builder()
.total("8")
.done("3")
.build();

given(repeatMissionArchiveReadUseCase.getMyMissionDoneStatus(any(),any())).willReturn(output);

Long teamId = 1L;
Long missionId = 1L;
//when
ResultActions actions = mockMvc.perform(RestDocumentationRequestBuilders.
get("/api/team/{teamId}/missions/{missionId}/archive/my-status",teamId,missionId)
.header("Authorization", "Bearer ACCESS_TOKEN")
.contentType(MediaType.APPLICATION_JSON)

);

//then
actions
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(
restDocs.document(
requestHeaders(
headerWithName("Authorization").description("접근 토큰")
),
pathParameters(
parameterWithName("teamId").description("팀 아이디"),
parameterWithName("missionId").description("미션 아이디")
),
responseFields(
fieldWithPath("isSuccess").description("true"),
fieldWithPath("message").description(MISSION_ARCHIVE_PEOPLE_STATUS_SUCCESS.getMessage()),
fieldWithPath("data.total").description("전체 미션 참여자"),
fieldWithPath("data.done").description("미션 인증 완료한 미션 참여자 ")

)
)
)
.andReturn();

}
@Test
public void 미션_인증물_좋아요() throws Exception {
Expand Down

0 comments on commit d39f97f

Please sign in to comment.