58 lines
1.7 KiB
Java
58 lines
1.7 KiB
Java
package com.myoa.engineering.crawl.ppomppu.processor.domain;
|
|
|
|
import com.myoa.engineering.crawl.ppomppu.support.dto.code.PpomppuBoardName;
|
|
import java.time.Instant;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.EnumType;
|
|
import javax.persistence.Enumerated;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.GenerationType;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.Table;
|
|
import lombok.Builder;
|
|
import lombok.Getter;
|
|
import lombok.NoArgsConstructor;
|
|
|
|
@Getter
|
|
@NoArgsConstructor
|
|
@Entity
|
|
@Table(name = "ppomppu_board_feed_status")
|
|
public class PpomppuBoardFeedStatus extends Auditable {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
@Column
|
|
private Long latestParsedArticleId;
|
|
|
|
@Column
|
|
@Enumerated(EnumType.STRING)
|
|
private PpomppuBoardName boardName;
|
|
|
|
@Column
|
|
private Instant updatedAt;
|
|
|
|
public static PpomppuBoardFeedStatus of(PpomppuBoardName boardName, Long latestArticleId) {
|
|
return PpomppuBoardFeedStatus.builder()
|
|
.boardName(boardName)
|
|
.latestParsedArticleId(latestArticleId)
|
|
.updatedAt(Instant.now())
|
|
.build();
|
|
}
|
|
|
|
public void updateArticleId(Long latestArticleId) {
|
|
this.updatedAt = Instant.now();
|
|
this.latestParsedArticleId = latestArticleId;
|
|
}
|
|
|
|
@Builder
|
|
public PpomppuBoardFeedStatus(Long id, Long latestParsedArticleId, PpomppuBoardName boardName, Instant updatedAt) {
|
|
this.id = id;
|
|
this.latestParsedArticleId = latestParsedArticleId;
|
|
this.boardName = boardName;
|
|
this.updatedAt = updatedAt;
|
|
}
|
|
}
|