-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
148 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
smeem-api/src/main/java/com/smeem/api/member/api/dto/response/MemberPlanGetResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.smeem.api.member.api.dto.response; | ||
|
||
import com.smeem.api.member.service.dto.response.MemberPlanGetServiceResponse; | ||
import lombok.Builder; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
@Builder(access = PRIVATE) | ||
public record MemberPlanGetResponse( | ||
String plan, | ||
String goal, | ||
int clearedCount, | ||
int clearCount | ||
) { | ||
|
||
public static MemberPlanGetResponse of(MemberPlanGetServiceResponse response) { | ||
return MemberPlanGetResponse.builder() | ||
.plan(response.plan().content()) | ||
.goal(response.goal().goalType().getDescription()) | ||
.clearedCount(response.plan().clearedCount()) | ||
.clearCount(response.plan().clearCount()) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...i/src/main/java/com/smeem/api/member/service/dto/request/MemberPlanGetServiceRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.smeem.api.member.service.dto.request; | ||
|
||
import lombok.Builder; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
@Builder(access = PRIVATE) | ||
public record MemberPlanGetServiceRequest( | ||
long memberId | ||
) { | ||
|
||
public static MemberPlanGetServiceRequest of(long memberId) { | ||
return MemberPlanGetServiceRequest.builder() | ||
.memberId(memberId) | ||
.build(); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...src/main/java/com/smeem/api/member/service/dto/response/MemberPlanGetServiceResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.smeem.api.member.service.dto.response; | ||
|
||
import com.smeem.domain.goal.model.GoalType; | ||
import com.smeem.domain.member.model.Member; | ||
import lombok.Builder; | ||
import lombok.val; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
@Builder(access = PRIVATE) | ||
public record MemberPlanGetServiceResponse( | ||
MemberGoalServiceResponse goal, | ||
MemberPlanServiceResponse plan | ||
) { | ||
|
||
public static MemberPlanGetServiceResponse of(Member member) { | ||
return MemberPlanGetServiceResponse.builder() | ||
.goal(MemberGoalServiceResponse.of(member)) | ||
.plan(MemberPlanServiceResponse.of(member)) | ||
.build(); | ||
} | ||
|
||
@Builder(access = PRIVATE) | ||
public record MemberPlanServiceResponse( | ||
String content, | ||
int clearCount, | ||
int clearedCount | ||
) { | ||
|
||
private static MemberPlanServiceResponse of(Member member) { | ||
val plan = member.getPlan(); | ||
return MemberPlanServiceResponse.builder() | ||
.content(plan.getContent()) | ||
.clearCount(plan.getClearCount()) | ||
.clearedCount(member.getDiaryCountInWeek()) | ||
.build(); | ||
} | ||
} | ||
|
||
@Builder(access = PRIVATE) | ||
public record MemberGoalServiceResponse( | ||
GoalType goalType | ||
) { | ||
|
||
private static MemberGoalServiceResponse of(Member member) { | ||
val goalType = member.getGoal(); | ||
return MemberGoalServiceResponse.builder() | ||
.goalType(goalType) | ||
.build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters