Skip to content

Commit

Permalink
Merge pull request #84 from YAPP-Github/feature/review
Browse files Browse the repository at this point in the history
review 생성 업데이트 시간 기록
  • Loading branch information
devk0ng authored Sep 30, 2023
2 parents 3db8775 + f53fb17 commit 025a6c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/main/java/com/pyonsnalcolor/product/dto/ReviewDto.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
package com.pyonsnalcolor.product.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.pyonsnalcolor.product.enumtype.Like;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
Expand All @@ -17,4 +24,12 @@ public class ReviewDto {
private String image;
private Long writerId; //작성자 <- 이후 기능 확장 고려한 필드
private String writerName; // 닉네임
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime createdTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime updatedTime;
}
5 changes: 3 additions & 2 deletions src/main/java/com/pyonsnalcolor/product/entity/Review.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Review {
public class Review extends BaseTimeEntity {
private Like taste; //맛
private Like quality; //퀄리티
private Like valueForMoney; //가성비
Expand All @@ -22,6 +22,7 @@ public class Review {
private String writerName;

public ReviewDto convertToDto() {
return new ReviewDto(taste, quality, valueForMoney, score, contents, image, writerId, writerName);
return new ReviewDto(taste, quality, valueForMoney, score, contents, image, writerId, writerName,
getCreatedDate(), getModifiedDate());
}
}

0 comments on commit 025a6c2

Please sign in to comment.