Skip to content

Commit

Permalink
#27 feat: CommentRes에 status, createdAt, updatedAt 필드값 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
xhaktmchl committed Nov 3, 2022
1 parent 1bb8a5f commit c6fc1e8
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.yogit.server.board.entity.ClipBoard;
import com.yogit.server.board.entity.Comment;
import com.yogit.server.config.domain.BaseStatus;
import com.yogit.server.user.entity.User;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
Expand Down Expand Up @@ -37,6 +38,18 @@ public class CommentRes {
@ApiParam(value = "ClipBoard ID")
private Long clipBoardId;

@ApiModelProperty(example = "ACTIVE")
@ApiParam(value = "객체 상태")
private BaseStatus status;

@ApiModelProperty(example = "2022-07-13 16:29:30")
@ApiParam(value = "생성 시각")
private String createdAt;

@ApiModelProperty(example = "2022-07-13 16:29:30")
@ApiParam(value = "마지막 업데이트 시각")
private String updatedAt;

public static CommentRes toDto(Comment comment){
return CommentRes.builder()
.commentId(comment.getId())
Expand All @@ -45,16 +58,22 @@ public static CommentRes toDto(Comment comment){
.userName(comment.getUser().getName())
.profileImg(comment.getUser().getProfileImg())
.clipBoardId(comment.getClipBoard().getId())
.status(comment.getStatus())
.createdAt(comment.getCreatedAt())
.updatedAt(comment.getUpdatedAt())
.build();
}

@Builder
public CommentRes(Long commentId, String content, Long userId, String userName, String profileImg, Long clipBoardId) {
public CommentRes(Long commentId, String content, Long userId, String userName, String profileImg, Long clipBoardId, BaseStatus status, String createdAt, String updatedAt) {
this.commentId = commentId;
this.content = content;
this.userId = userId;
this.userName = userName;
this.profileImg = profileImg;
this.clipBoardId = clipBoardId;
this.status = status;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
}

0 comments on commit c6fc1e8

Please sign in to comment.