Skip to content

Commit

Permalink
feat: Add isMeMissionUploadedToday field And Rename IsMeUploadedToday…
Browse files Browse the repository at this point in the history
… as isMeSurvivalUploadedToday from DaytimePageResponse
  • Loading branch information
Kwon770 committed Apr 24, 2024
1 parent 042c990 commit 2ec0215
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ public DaytimePageResponse getDaytimePage(
String dailyMissionContent = missionBridge.getContentByMissionId(todayMissionId);
boolean isMissionUnlocked = postController.getMissionAvailableStatus(loginMemberId, loginMemberId, familyId)
.isMissionUnlocked();
boolean isMeUploadedToday = postController.getSurvivalUploadStatus(loginMemberId, loginMemberId, familyId)
.isMeUploadedToday();
boolean isMeSurvivalUploadedToday = postController.getSurvivalUploadStatus(loginMemberId, loginMemberId, familyId)
.isMeSurvivalUploadedToday();
boolean isMeMissionUploadedToday = postController.getMissionUploadStatus(loginMemberId, loginMemberId, familyId)
.isMeMissionUploadedToday();
int leftUploadCountUntilMissionUnlock = postController.getRemainingSurvivalPostCount(loginMemberId, loginMemberId, familyId)
.leftUploadCountUntilMissionUnlock();

Expand Down Expand Up @@ -107,7 +109,9 @@ public DaytimePageResponse getDaytimePage(

isMissionUnlocked,

isMeUploadedToday,
isMeSurvivalUploadedToday,

isMeMissionUploadedToday,

dailyMissionContent,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public record DaytimePageResponse(
@Schema(description = "미션 해금 여부", example = "true")
boolean isMissionUnlocked,

@Schema(description = "오늘 나 업로드 여부", example = "true")
boolean isMeUploadedToday,
@Schema(description = "오늘 요청자가 생존신고를 업로드 했는지 여부", example = "true")
boolean isMeSurvivalUploadedToday,

@Schema(description = "오늘 요청자가 미션을 업로드 했는지 여부", example = "true")
boolean isMeMissionUploadedToday,

@Schema(description = "오늘의 미션 내용 (모킹됨)", example = "오늘의 기분을 나타내는 사진 찍기.")
String dailyMissionContent,
Expand Down
10 changes: 10 additions & 0 deletions post/src/main/java/com/oing/controller/PostController.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ public SurvivalUploadStatusResponse getSurvivalUploadStatus(String memberId, Str
return new SurvivalUploadStatusResponse(false);
}

@Override
public MissionUploadStatusResponse getMissionUploadStatus(String memberId, String loginMemberId, String loginFamilyId) {
validateMemberId(loginMemberId, memberId);

if (postService.existsByMemberIdAndFamilyIdAndTypeAndCreatedAt(memberId, loginFamilyId, PostType.MISSION, LocalDate.now())) {
return new MissionUploadStatusResponse(true);
}
return new MissionUploadStatusResponse(false);
}

@Override
public MissionAvailableStatusResponse getMissionAvailableStatus(String memberId, String loginMemberId, String loginFamilyId) {
validateMemberId(loginMemberId, memberId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.oing.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "회원 미션 게시글 업로드 여부 응답")
public record MissionUploadStatusResponse(
@Schema(description = "회원 미션 게시글 업로드 여부", example = "true")
boolean isMeMissionUploadedToday
) {
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.oing.dto.response;

import com.oing.domain.Reaction;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "회원 생존신고 게시글 업로드 여부 응답")
public record SurvivalUploadStatusResponse(
@Schema(description = "회원 생존신고 게시글 업로드 여부", example = "true")
boolean isMeUploadedToday
boolean isMeSurvivalUploadedToday
) {
}
16 changes: 16 additions & 0 deletions post/src/main/java/com/oing/restapi/PostApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ SurvivalUploadStatusResponse getSurvivalUploadStatus(
String loginFamilyId
);

@Operation(summary = "회원 미션 게시글 업로드 여부 응답 조회", description = "회원 미션 게시글 업로드 여부를 조회합니다.")
@GetMapping("/{memberId}/mission-uploaded")
MissionUploadStatusResponse getMissionUploadStatus(
@PathVariable
@Parameter(description = "대상 사용자 ID", example = "01HGW2N7EHJVJ4CJ999RRS2E97")
String memberId,

@Parameter(hidden = true)
@LoginMemberId
String loginMemberId,

@Parameter(hidden = true)
@LoginFamilyId
String loginFamilyId
);

@Operation(summary = "회원 미션 참여 가능 여부 응답 조회", description = "회원 미션 참여 가능 여부를 조회합니다.")
@GetMapping("/{memberId}/mission-available")
MissionAvailableStatusResponse getMissionAvailableStatus(
Expand Down

0 comments on commit 2ec0215

Please sign in to comment.