From 7d12468a3f76af19a3cdf088401052d085dbd70b Mon Sep 17 00:00:00 2001 From: seungyeonnnnnni Date: Fri, 3 Nov 2023 01:32:29 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EB=AF=B8=EC=85=98=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EB=AC=BC=20=ED=83=80=EC=9E=85=20=EB=A6=AC=ED=84=B4?= =?UTF-8?q?=EA=B0=92=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EB=82=98=EC=9D=98?= =?UTF-8?q?=20=EC=84=B1=EA=B3=B5=20=ED=9A=9F=EC=88=98=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20adoc=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/docs/asciidoc/MissionArchive-API.adoc | 6 +++ .../dto/res/MissionArchiveRes.java | 8 +-- .../dto/res/PersonalArchiveRes.java | 1 + .../mapper/MissionArchiveMapper.java | 2 + .../MissionArchiveCustomRepositoryImpl.java | 3 +- .../MissionArchiveControllerTest.java | 53 +++++++++++++++++++ 6 files changed, 65 insertions(+), 8 deletions(-) diff --git a/src/docs/asciidoc/MissionArchive-API.adoc b/src/docs/asciidoc/MissionArchive-API.adoc index e60833cf..e70060cb 100644 --- a/src/docs/asciidoc/MissionArchive-API.adoc +++ b/src/docs/asciidoc/MissionArchive-API.adoc @@ -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'] diff --git a/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/MissionArchiveRes.java b/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/MissionArchiveRes.java index b976e42a..b154c6ce 100644 --- a/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/MissionArchiveRes.java +++ b/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/MissionArchiveRes.java @@ -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"; - } - } } diff --git a/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/PersonalArchiveRes.java b/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/PersonalArchiveRes.java index 01f630d8..70dc9df0 100644 --- a/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/PersonalArchiveRes.java +++ b/src/main/java/com/moing/backend/domain/missionArchive/application/dto/res/PersonalArchiveRes.java @@ -14,6 +14,7 @@ public class PersonalArchiveRes { private String archive; private String createdDate; + private String way; private String heartStatus; private int hearts; diff --git a/src/main/java/com/moing/backend/domain/missionArchive/application/mapper/MissionArchiveMapper.java b/src/main/java/com/moing/backend/domain/missionArchive/application/mapper/MissionArchiveMapper.java index bf857493..47e2b5a7 100644 --- a/src/main/java/com/moing/backend/domain/missionArchive/application/mapper/MissionArchiveMapper.java +++ b/src/main/java/com/moing/backend/domain/missionArchive/application/mapper/MissionArchiveMapper.java @@ -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()) @@ -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()) diff --git a/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java b/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java index 1860601d..d3f37843 100644 --- a/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java +++ b/src/main/java/com/moing/backend/domain/missionArchive/domain/repository/MissionArchiveCustomRepositoryImpl.java @@ -141,11 +141,12 @@ public Optional> findOthersArchives(Long memberId, Long mis @Override public Optional 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() ); diff --git a/src/test/java/com/moing/backend/domain/missionArchive/representation/MissionArchiveControllerTest.java b/src/test/java/com/moing/backend/domain/missionArchive/representation/MissionArchiveControllerTest.java index 1114ec38..eb60edd5 100644 --- a/src/test/java/com/moing/backend/domain/missionArchive/representation/MissionArchiveControllerTest.java +++ b/src/test/java/com/moing/backend/domain/missionArchive/representation/MissionArchiveControllerTest.java @@ -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]") @@ -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("미션 인증 횟수"), @@ -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) @@ -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("미션 인증 상태"), @@ -184,6 +188,7 @@ public class MissionArchiveControllerTest extends CommonControllerTest { List 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) @@ -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("미션 인증 횟수"), @@ -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) @@ -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("미션 인증 횟수"), @@ -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 {