Skip to content

Commit

Permalink
feat: Post boostDate Column 추가 및 적용 (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeong-hyeok committed Dec 14, 2024
1 parent 5ecd82a commit e351ed6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;

public record PostCreateRequest(@NotBlank(message = "출발 지역은 필수 입력 값입니다.")
String departureLoc,
Expand Down Expand Up @@ -45,6 +46,7 @@ public static Post postToEntity(PostCreateRequest request, Dog dog, Intermediary
.status(PostStatus.RECRUITING)
.dog(dog)
.intermediary(intermediary)
.boostDate(LocalDateTime.now())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.*;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down Expand Up @@ -42,9 +43,10 @@ public class Post extends BaseTimeEntity {
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dog_id", nullable = false)
private Dog dog; // 강아지 id
private LocalDateTime boostDate; // 끌어올리기 날짜

@Builder
public Post(PostStatus status, String departureLoc, String arrivalLoc, LocalDate startDate, LocalDate endDate, String pickUpTime, Boolean isKennel, String content, Intermediary intermediary, Dog dog) {
public Post(PostStatus status, String departureLoc, String arrivalLoc, LocalDate startDate, LocalDate endDate, String pickUpTime, Boolean isKennel, String content, Intermediary intermediary, Dog dog, LocalDateTime boostDate) {
this.status = status;
this.departureLoc = departureLoc;
this.arrivalLoc = arrivalLoc;
Expand All @@ -55,6 +57,7 @@ public Post(PostStatus status, String departureLoc, String arrivalLoc, LocalDate
this.content = content;
this.intermediary = intermediary;
this.dog = dog;
this.boostDate = boostDate;
}

public void updateMainImage(PostImage mainImage) {
Expand Down

0 comments on commit e351ed6

Please sign in to comment.