diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeRes.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeRes.java index b91f828..9830ebd 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeRes.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/controller/challengegroup/challenge/ChallengeRes.java @@ -9,7 +9,7 @@ import org.haedal.zzansuni.domain.challengegroup.challenge.ChallengeModel; import org.haedal.zzansuni.domain.challengegroup.challenge.ChallengeModel.ChallengeCurrent; import org.haedal.zzansuni.domain.challengegroup.challenge.ChallengeModel.ChallengeRecord; -import org.haedal.zzansuni.domain.challengegroup.challengeverification.ChallengeVerificationModel; +import org.haedal.zzansuni.domain.challengegroup.verification.ChallengeVerificationModel; public class ChallengeRes { diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/challenge/ChallengeModel.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/challenge/ChallengeModel.java index 755ae99..d30c38c 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/challenge/ChallengeModel.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/challenge/ChallengeModel.java @@ -1,12 +1,15 @@ package org.haedal.zzansuni.domain.challengegroup.challenge; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; import java.util.stream.Collectors; import lombok.Builder; import lombok.Getter; +import org.haedal.zzansuni.domain.challengegroup.ChallengeCategory; import org.haedal.zzansuni.domain.challengegroup.ChallengeGroup; import org.haedal.zzansuni.domain.challengegroup.DayType; +import org.haedal.zzansuni.domain.challengegroup.userchallenge.UserChallenge; import org.haedal.zzansuni.domain.challengegroup.verification.ChallengeVerification; @Getter @@ -76,5 +79,36 @@ public static ChallengeRecord from(Challenge challenge, ChallengeGroup challenge } } + @Builder + public record ChallengeCurrent( + Long challengeId, + String title, + Integer totalCount, + Integer successCount, + LocalDateTime participationDate, + LocalDate startDate, + LocalDate endDate, + ChallengeCategory category, + Boolean reviewWritten + ) { + + public static ChallengeCurrent from(UserChallenge userChallenge, Boolean reviewWritten) { + Challenge challenge = userChallenge.getChallenge(); + return ChallengeCurrent.builder() + .challengeId(challenge.getId()) + .title(challenge.getChallengeGroup().getTitle()) + .totalCount(challenge.getRequiredCount()) + .successCount(userChallenge.getChallengeVerifications().size()) + .participationDate(userChallenge.getCreatedAt()) + .startDate(challenge.getStartDate()) + .endDate(challenge.getEndDate()) + .category(challenge.getChallengeGroup().getCategory()) + .reviewWritten(reviewWritten) + .build(); + } + + } + + } diff --git a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeService.java b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeService.java index e4bdb7f..b16d34e 100644 --- a/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeService.java +++ b/zzansuni-api-server/app/src/main/java/org/haedal/zzansuni/domain/challengegroup/userchallenge/UserChallengeService.java @@ -8,7 +8,7 @@ import org.haedal.zzansuni.domain.challengegroup.challenge.ChallengeCommand; import org.haedal.zzansuni.domain.challengegroup.challenge.ChallengeModel; import org.haedal.zzansuni.domain.challengegroup.challenge.ChallengeReader; -import org.haedal.zzansuni.domain.challengegroup.challengereview.ChallengeReviewReader; +import org.haedal.zzansuni.domain.challengegroup.review.ChallengeReviewReader; import org.haedal.zzansuni.domain.user.User; import org.haedal.zzansuni.domain.user.UserReader; import org.springframework.data.domain.Page;