-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardSetDetailResponse.java
More file actions
44 lines (37 loc) · 983 Bytes
/
CardSetDetailResponse.java
File metadata and controls
44 lines (37 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package project.flipnote.cardset.model;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import project.flipnote.cardset.entity.CardSet;
public record CardSetDetailResponse(
Long cardSetId,
Long groupId,
String name,
String category,
String hashtag,
String imageUrl,
Long imageRefId,
boolean publicVisible,
boolean liked,
boolean bookmarked,
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
LocalDateTime createdAt,
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
LocalDateTime modifiedAt
) {
public static CardSetDetailResponse from(CardSet cardSet, boolean liked, boolean bookmarked, Long imageRefId) {
return new CardSetDetailResponse(
cardSet.getId(),
cardSet.getGroup().getId(),
cardSet.getName(),
cardSet.getCategory().name(),
cardSet.getHashtag(),
cardSet.getImageUrl(),
imageRefId,
cardSet.getPublicVisible(),
liked,
bookmarked,
cardSet.getCreatedAt(),
cardSet.getModifiedAt()
);
}
}