Skip to content

Commit

Permalink
hotfix: add nullable flow
Browse files Browse the repository at this point in the history
  • Loading branch information
thguss committed Aug 10, 2024
1 parent f6e7d4f commit 5d4a1b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ public void updatePlan(long memberId, UpdateMemberPlanRequest request) {

public RetrieveMemberPlanResponse retrieveMemberPlan(long memberId) {
val foundMember = memberPort.findById(memberId);
val foundPlan = planPort.findById(foundMember.getPlanId());
val planId = foundMember.getPlanId();
val foundPlan = planId != null ? planPort.findById(foundMember.getPlanId()) : null;
val foundGoal = goalPort.findById(foundMember.getGoalId());
return RetrieveMemberPlanResponse.of(
foundGoal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public record RetrieveMemberPlanResponse(
@Schema(description = "성취한 횟수")
int clearedCount,
@Schema(description = "전체 성취 횟수")
int clearCount
Integer clearCount
) {

public static RetrieveMemberPlanResponse of(Goal goal, Plan plan, int diaryCount) {
return RetrieveMemberPlanResponse.builder()
.plan(plan.getContent())
.plan(plan != null ? plan.getContent() : null)
.goal(goal.getGoalType().getDescription())
.clearCount(plan.getClearCount())
.clearCount(plan != null ? plan.getClearCount() : null)
.clearedCount(diaryCount)
.build();
}
Expand Down

0 comments on commit 5d4a1b2

Please sign in to comment.