-
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.
- Loading branch information
Showing
3 changed files
with
98 additions
and
94 deletions.
There are no files selected for viewing
92 changes: 47 additions & 45 deletions
92
backend/memetory/src/main/java/com/example/memetory/domain/memes/dto/MemesInfo.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 |
---|---|---|
@@ -1,59 +1,61 @@ | ||
package com.example.memetory.domain.memes.dto; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import com.example.memetory.domain.memes.entity.Memes; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@Schema(description = "밈스 정보") | ||
public class MemesInfo { | ||
|
||
@Schema(description = "밈스 아이디") | ||
private Long memesId; | ||
|
||
@Schema(description = "밈스를 생성한 멤버 아이디") | ||
private Long memberId; | ||
|
||
@Schema(description = "밈스로 보여줄 밈의 S3 주소") | ||
private String memeUrl; | ||
|
||
@Schema(description = "밈스 제목") | ||
private String title; | ||
|
||
@Schema(description = "댓글 수") | ||
private int commentCount; | ||
|
||
@Schema(description = "좋아요 수") | ||
private int likeCount; | ||
|
||
@Schema(description = "밈스 생성 시각") | ||
private LocalDateTime createdAt; | ||
|
||
@Builder | ||
public MemesInfo(Long memesId, Long memberId, String memeUrl, String title, int commentCount, int likeCount, LocalDateTime createdAt) { | ||
this.memesId = memesId; | ||
this.memberId = memberId; | ||
this.memeUrl = memeUrl; | ||
this.title = title; | ||
this.commentCount = commentCount; | ||
this.likeCount = likeCount; | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public static MemesInfo of(Memes memes) { | ||
return MemesInfo.builder() | ||
.memesId(memes.getId()) | ||
.memberId(memes.getMember().getId()) | ||
.memeUrl(memes.getMeme().getS3Url()) | ||
.title(memes.getTitle()) | ||
.commentCount(memes.getCommentCount()) | ||
.likeCount(memes.getLikeCount()) | ||
.createdAt(memes.getCreatedAt()) | ||
.build(); | ||
} | ||
@Schema(description = "밈스 아이디") | ||
private Long memesId; | ||
|
||
@Schema(description = "밈스를 생성한 멤버 아이디") | ||
private Long memberId; | ||
|
||
@Schema(description = "밈스로 보여줄 밈의 S3 주소") | ||
private String memeUrl; | ||
|
||
@Schema(description = "밈스 제목") | ||
private String title; | ||
|
||
@Schema(description = "댓글 수") | ||
private Long commentCount; | ||
|
||
@Schema(description = "좋아요 수") | ||
private Long likeCount; | ||
|
||
@Schema(description = "밈스 생성 시각") | ||
private LocalDateTime createdAt; | ||
|
||
@Builder | ||
public MemesInfo(Long memesId, Long memberId, String memeUrl, String title, Long commentCount, Long likeCount, | ||
LocalDateTime createdAt) { | ||
this.memesId = memesId; | ||
this.memberId = memberId; | ||
this.memeUrl = memeUrl; | ||
this.title = title; | ||
this.commentCount = commentCount; | ||
this.likeCount = likeCount; | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public static MemesInfo of(Memes memes) { | ||
return MemesInfo.builder() | ||
.memesId(memes.getId()) | ||
.memberId(memes.getMember().getId()) | ||
.memeUrl(memes.getMeme().getS3Url()) | ||
.title(memes.getTitle()) | ||
.commentCount(memes.getCommentCount()) | ||
.likeCount(memes.getLikeCount()) | ||
.createdAt(memes.getCreatedAt()) | ||
.build(); | ||
} | ||
} |
94 changes: 48 additions & 46 deletions
94
.../memetory/src/main/java/com/example/memetory/domain/memes/dto/response/MemesResponse.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 |
---|---|---|
@@ -1,70 +1,72 @@ | ||
package com.example.memetory.domain.memes.dto.response; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
import com.example.memetory.domain.comment.dto.CommentInfo; | ||
import com.example.memetory.domain.memes.entity.Memes; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@Schema(description = "밈스 단일 조회 반환 형식") | ||
public class MemesResponse { | ||
@Schema(description = "밈스 아이디") | ||
private Long memesId; | ||
@Schema(description = "밈스 아이디") | ||
private Long memesId; | ||
|
||
@Schema(description = "밈스를 생성한 멤버 아이디") | ||
private Long memberId; | ||
@Schema(description = "밈스를 생성한 멤버 아이디") | ||
private Long memberId; | ||
|
||
@Schema(description = "밈스를 생성한 멤버 이름") | ||
private String memberName; | ||
@Schema(description = "밈스를 생성한 멤버 이름") | ||
private String memberName; | ||
|
||
@Schema(description = "밈스로 보여줄 밈의 S3 주소") | ||
private String memeUrl; | ||
@Schema(description = "밈스로 보여줄 밈의 S3 주소") | ||
private String memeUrl; | ||
|
||
@Schema(description = "밈스 제목") | ||
private String title; | ||
@Schema(description = "밈스 제목") | ||
private String title; | ||
|
||
@Schema(description = "댓글 수") | ||
private int commentCount; | ||
@Schema(description = "댓글 수") | ||
private Long commentCount; | ||
|
||
@Schema(description = "댓글 리스트") | ||
private List<CommentInfo> commentInfoList; | ||
@Schema(description = "댓글 리스트") | ||
private List<CommentInfo> commentInfoList; | ||
|
||
@Schema(description = "좋아요 수") | ||
private int likeCount; | ||
@Schema(description = "좋아요 수") | ||
private Long likeCount; | ||
|
||
@Schema(description = "밈스 생성 시각") | ||
private LocalDateTime createdAt; | ||
@Schema(description = "밈스 생성 시각") | ||
private LocalDateTime createdAt; | ||
|
||
@Builder | ||
public MemesResponse(Long memesId, Long memberId, String memberName, String memeUrl, String title, int commentCount, List<CommentInfo> commentInfoList, int likeCount, LocalDateTime createdAt) { | ||
this.memesId = memesId; | ||
this.memberId = memberId; | ||
this.memberName = memberName; | ||
this.memeUrl = memeUrl; | ||
this.title = title; | ||
this.commentCount = commentCount; | ||
this.commentInfoList = commentInfoList; | ||
this.likeCount = likeCount; | ||
this.createdAt = createdAt; | ||
} | ||
@Builder | ||
public MemesResponse(Long memesId, Long memberId, String memberName, String memeUrl, String title, | ||
Long commentCount, List<CommentInfo> commentInfoList, Long likeCount, LocalDateTime createdAt) { | ||
this.memesId = memesId; | ||
this.memberId = memberId; | ||
this.memberName = memberName; | ||
this.memeUrl = memeUrl; | ||
this.title = title; | ||
this.commentCount = commentCount; | ||
this.commentInfoList = commentInfoList; | ||
this.likeCount = likeCount; | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public static MemesResponse of(Memes memes) { | ||
return MemesResponse.builder() | ||
.memesId(memes.getId()) | ||
.memberId(memes.getMember().getId()) | ||
.memberName(memes.getMember().getName()) | ||
.memeUrl(memes.getMeme().getS3Url()) | ||
.title(memes.getTitle()) | ||
.commentCount(memes.getCommentCount()) | ||
.commentInfoList(memes.getComments().stream().map(CommentInfo::of).toList()) | ||
.likeCount(memes.getLikeCount()) | ||
.createdAt(memes.getCreatedAt()) | ||
.build(); | ||
} | ||
public static MemesResponse of(Memes memes) { | ||
return MemesResponse.builder() | ||
.memesId(memes.getId()) | ||
.memberId(memes.getMember().getId()) | ||
.memberName(memes.getMember().getName()) | ||
.memeUrl(memes.getMeme().getS3Url()) | ||
.title(memes.getTitle()) | ||
.commentCount(memes.getCommentCount()) | ||
.commentInfoList(memes.getComments().stream().map(CommentInfo::of).toList()) | ||
.likeCount(memes.getLikeCount()) | ||
.createdAt(memes.getCreatedAt()) | ||
.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