-
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.
Browse files
Browse the repository at this point in the history
Issue/#25
- Loading branch information
Showing
8 changed files
with
235 additions
and
60 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
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
58 changes: 58 additions & 0 deletions
58
.../src/main/java/org/haedal/zzansuni/domain/challengegroup/review/ChallengeReviewModel.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,58 @@ | ||
package org.haedal.zzansuni.domain.challengegroup.review; | ||
|
||
import lombok.Builder; | ||
import org.haedal.zzansuni.domain.user.UserModel; | ||
|
||
public class ChallengeReviewModel { | ||
|
||
@Builder | ||
public record ChallengeReviewWithUserInfo( | ||
Long challengeId, | ||
String challengeTitle, | ||
UserModel user, | ||
String content, | ||
Integer rating | ||
) { | ||
|
||
public static ChallengeReviewWithUserInfo from(ChallengeReview challengeReview) { | ||
var userModel = UserModel.from(challengeReview.getUserChallenge().getUser()); | ||
return ChallengeReviewWithUserInfo.builder() | ||
.challengeId(challengeReview.getUserChallenge().getChallenge().getId()) | ||
.challengeTitle( | ||
challengeReview.getUserChallenge().getChallenge().getChallengeGroup() | ||
.getTitle()) | ||
.user(userModel) | ||
.content(challengeReview.getContent()) | ||
.rating(challengeReview.getRating()) | ||
.build(); | ||
} | ||
} | ||
|
||
@Builder | ||
public record ChallengeReviewWithChallenge( | ||
Long challengeId, | ||
String challengeTitle, | ||
Integer challengeDifficulty, | ||
UserModel user, | ||
String content, | ||
Integer rating | ||
) { | ||
|
||
public static ChallengeReviewWithChallenge from(ChallengeReview challengeReview) { | ||
var userModel = UserModel.from(challengeReview.getUserChallenge().getUser()); | ||
return ChallengeReviewWithChallenge.builder() | ||
.challengeId(challengeReview.getUserChallenge().getChallenge().getId()) | ||
.challengeTitle( | ||
challengeReview.getUserChallenge().getChallenge().getChallengeGroup() | ||
.getTitle()) | ||
.challengeDifficulty( | ||
challengeReview.getUserChallenge().getChallenge().getDifficulty()) | ||
.user(userModel) | ||
.content(challengeReview.getContent()) | ||
.rating(challengeReview.getRating()) | ||
.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
Oops, something went wrong.