Skip to content

Commit

Permalink
FEAT : challenge id 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
gaguriee committed Aug 10, 2024
1 parent 85e005a commit 9158eda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public class ChallengeDetailResponse extends ChallengeResponse {
@Schema(description = "사용자 참여 여부", example = "true")
private boolean isParticipating;

public ChallengeDetailResponse(String title, int likeCount, List<ChallengeCategory> categories, String type,
public ChallengeDetailResponse(long id, String title, int likeCount, List<ChallengeCategory> categories, String type,
String description, double successRate, int successCount, int participantCount, boolean isParticipating) {
super(title, likeCount, categories, type, description, successRate, successCount, participantCount, null, null, null);
super(id, title, likeCount, categories, type, description, successRate, successCount, participantCount, null, null, null);
this.isParticipating = isParticipating;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
@Schema(description = "챌린지 응답 DTO")
public class ChallengeResponse {

@Schema(description = "챌린지 id", example = "1")
private final long id;

@Schema(description = "챌린지 제목", example = "챌린지 타이틀")
private final String title;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public ChallengeDetailResponse getChallengeById(Long challengeId) {
boolean isParticipating = SecurityUtils.isAuthenticated() && challengeParticipationRepository.existsByMemberIdAndChallengeId(SecurityUtils.getCurrentUserId(), challengeId);

return new ChallengeDetailResponse(
challenge.getId(),
challenge.getTitle(),
challenge.getLikeCount(),
challenge.getCategories(),
Expand Down Expand Up @@ -107,6 +108,7 @@ private Page<ChallengeResponse> getChallengesByTypeAndCategories(int page, int s

private ChallengeResponse createChallengeResponse(Challenge challenge) {
return new ChallengeResponse(
challenge.getId(),
challenge.getTitle(),
challenge.getLikeCount(),
challenge.getCategories(),
Expand All @@ -121,6 +123,7 @@ private ChallengeResponse createChallengeResponse(Challenge challenge) {

private ChallengeResponse createChallengeResponseWithSupport(Challenge challenge) {
return new ChallengeResponse(
challenge.getId(),
challenge.getTitle(),
challenge.getLikeCount(),
challenge.getCategories(),
Expand Down

0 comments on commit 9158eda

Please sign in to comment.