-
Notifications
You must be signed in to change notification settings - Fork 1
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
9 changed files
with
118 additions
and
56 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
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
59 changes: 59 additions & 0 deletions
59
...ddingdongBE/domain/scorehistory/controller/dto/response/ClubScoreHistoryListResponse.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,59 @@ | ||
package ddingdong.ddingdongBE.domain.scorehistory.controller.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import ddingdong.ddingdongBE.domain.scorehistory.entity.ScoreHistory; | ||
import ddingdong.ddingdongBE.domain.scorehistory.service.dto.query.ClubScoreHistoryListQuery; | ||
import io.swagger.v3.oas.annotations.media.ArraySchema; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.math.BigDecimal; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Schema( | ||
name = "ClubScoreHistoryListResponse", | ||
description = "동아리 - 동아리 점수 변동 내역 목록 응답" | ||
) | ||
public record ClubScoreHistoryListResponse( | ||
|
||
@Schema(description = "동아리 총 점수", example = "50") | ||
BigDecimal totalScore, | ||
@ArraySchema(schema = @Schema(description = "점수내역 목록", implementation = ScoreHistoryResponse.class)) | ||
List<ScoreHistoryResponse> scoreHistories | ||
) { | ||
|
||
public static ClubScoreHistoryListResponse from(ClubScoreHistoryListQuery query) { | ||
return new ClubScoreHistoryListResponse( | ||
query.club().getScore().getValue(), | ||
query.scoreHistories().stream() | ||
.map(ScoreHistoryResponse::from) | ||
.toList() | ||
); | ||
} | ||
|
||
@Schema( | ||
name = "ScoreHistoryResponse", | ||
description = "점수 변동 내역 응답" | ||
) | ||
public record ScoreHistoryResponse( | ||
|
||
@Schema(description = "점수 내역 카테고리", example = "활동보고서") | ||
String scoreCategory, | ||
@Schema(description = "점수 내역 이유", example = "활동보고서 작성") | ||
String reason, | ||
@Schema(description = "변동 점수", example = "10") | ||
BigDecimal amount, | ||
@Schema(description = "작성일", example = "2024-01-01") | ||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
LocalDateTime createdAt | ||
) { | ||
|
||
public static ScoreHistoryResponse from(ScoreHistory scoreHistory) { | ||
return new ScoreHistoryResponse( | ||
scoreHistory.getScoreCategory().getCategory(), | ||
scoreHistory.getReason(), | ||
scoreHistory.getAmount(), | ||
scoreHistory.getCreatedAt() | ||
); | ||
} | ||
} | ||
} |
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