Skip to content

Commit

Permalink
feat: 미션 목록 조회 시 인증필요인 경우 MissionRecordId도 같이 응답 (#170)
Browse files Browse the repository at this point in the history
* feat: Mission 리스트 조회 시 응답값에 MissionRecordId 필드 추가

* feat: 인증 필요인 경우 missionRecordId 값 추가

* style: spotless

* test: MissionFindAllResponse 필드 추가로 test 수정

* style: spotless
  • Loading branch information
kdomo authored Jan 16, 2024
1 parent 9de4bd3 commit 5e16273
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ public List<MissionFindAllResponse> findAllMission() {

// 당일 수행한 미션기록이 없으면 NONE
if (optionalRecord.isEmpty()) {
results.add(MissionFindAllResponse.of(mission, MissionStatus.NONE, null));
results.add(MissionFindAllResponse.of(mission, MissionStatus.NONE, null, null));
continue;
}

// 당일 수행한 미션기록의 인증사진이 존재하면 COMPLETE
if (optionalRecord.get().getUploadStatus() == ImageUploadStatus.COMPLETE) {
results.add(MissionFindAllResponse.of(mission, MissionStatus.COMPLETED, null));
results.add(
MissionFindAllResponse.of(mission, MissionStatus.COMPLETED, null, null));
continue;
}

Expand All @@ -83,7 +84,8 @@ public List<MissionFindAllResponse> findAllMission() {
MissionFindAllResponse.of(
mission,
MissionStatus.REQUIRED,
missionRecordTTL.get().getTtlFinishedAt()));
missionRecordTTL.get().getTtlFinishedAt(),
optionalRecord.get().getId()));
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ public record MissionFindAllResponse(
@Schema(description = "미션 아카이빙 상태", defaultValue = "NONE") ArchiveStatus archiveStatus,
@Schema(description = "미션 정렬 값", defaultValue = "1") Integer sort,
@Schema(description = "미션 상태", defaultValue = "1") MissionStatus missionStatus,
@Schema(description = "인증 TTL 종료 시간", defaultValue = "NONE") LocalDateTime ttlFinishedAt) {
@Schema(description = "인증 TTL 종료 시간", defaultValue = "NONE") LocalDateTime ttlFinishedAt,
@Schema(description = "인증필요인경우 recordId", defaultValue = "1") Long missionRecordId) {

public static MissionFindAllResponse of(
Mission mission, MissionStatus missionStatus, LocalDateTime ttlFinishedAt) {
Mission mission,
MissionStatus missionStatus,
LocalDateTime ttlFinishedAt,
Long missionRecordId) {
return new MissionFindAllResponse(
mission.getId(),
mission.getName(),
Expand All @@ -29,6 +33,7 @@ public static MissionFindAllResponse of(
mission.getArchiveStatus(),
mission.getSort(),
missionStatus,
ttlFinishedAt);
ttlFinishedAt,
missionRecordId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ class MissionControllerTest {

List<MissionFindAllResponse> missionList =
Arrays.asList(
MissionFindAllResponse.of(mission, MissionStatus.NONE, ttlFinishedAt),
MissionFindAllResponse.of(mission, MissionStatus.COMPLETED, ttlFinishedAt),
MissionFindAllResponse.of(mission, MissionStatus.REQUIRED, ttlFinishedAt));
MissionFindAllResponse.of(mission, MissionStatus.NONE, null, null),
MissionFindAllResponse.of(mission, MissionStatus.COMPLETED, null, null),
MissionFindAllResponse.of(
mission, MissionStatus.REQUIRED, ttlFinishedAt, null));
given(missionService.findAllMission()).willReturn(missionList);

// when, then
Expand Down

0 comments on commit 5e16273

Please sign in to comment.