65 lines
1.7 KiB
Java
65 lines
1.7 KiB
Java
package com.hlab.yanalyst.domain.video;
|
|
|
|
import com.hlab.yanalyst.domain.channel.Channel;
|
|
import jakarta.persistence.*;
|
|
import lombok.AccessLevel;
|
|
import lombok.Builder;
|
|
import lombok.Getter;
|
|
import lombok.NoArgsConstructor;
|
|
import org.springframework.data.annotation.CreatedDate;
|
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
@Entity
|
|
@Table(name = "videos")
|
|
@Getter
|
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
|
@EntityListeners(AuditingEntityListener.class)
|
|
public class Video {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
@Column(nullable = false, unique = true)
|
|
private String videoId; // YouTube Video ID
|
|
|
|
@Column(nullable = false)
|
|
private String title;
|
|
|
|
@Column(columnDefinition = "TEXT")
|
|
private String description;
|
|
|
|
private String thumbnailUrl;
|
|
|
|
private String videoUrl;
|
|
|
|
private Long viewCount;
|
|
|
|
private Long likeCount;
|
|
|
|
private LocalDateTime publishedAt;
|
|
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
|
@JoinColumn(name = "channel_id")
|
|
private Channel channel;
|
|
|
|
@CreatedDate
|
|
@Column(updatable = false)
|
|
private LocalDateTime collectedAt;
|
|
|
|
@Builder
|
|
public Video(String videoId, String title, String description, String thumbnailUrl, String videoUrl, Long viewCount, Long likeCount, LocalDateTime publishedAt, Channel channel) {
|
|
this.videoId = videoId;
|
|
this.title = title;
|
|
this.description = description;
|
|
this.thumbnailUrl = thumbnailUrl;
|
|
this.videoUrl = videoUrl;
|
|
this.viewCount = viewCount;
|
|
this.likeCount = likeCount;
|
|
this.publishedAt = publishedAt;
|
|
this.channel = channel;
|
|
}
|
|
}
|