ADD Clip Table

This commit is contained in:
2025-06-13 10:35:52 +02:00
parent fa120fe7b5
commit 0986552059
5 changed files with 95 additions and 2 deletions

View File

@@ -0,0 +1,49 @@
package com.ddf.vodsystem.entities;
import jakarta.persistence.*;
import lombok.Data;
import lombok.ToString;
import java.time.LocalDateTime;
@Entity
@Table(name = "clips")
@Data
public class Clip {
@Id
@Column(name = "id", nullable = false, unique = true)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
@ToString.Exclude
@JoinColumn(name = "user_id", nullable = false)
private User user;
@Column(name = "title", nullable = false, length = 255)
private String title;
@Column(name = "description")
private String description;
@Column(name = "created_at")
private LocalDateTime createdAt;
@Column(name = "width", nullable = false)
private Integer width;
@Column(name = "height", nullable = false)
private Integer height;
@Column(name = "fps", nullable = false)
private Integer fps;
@Column(name = "duration", nullable = false)
private Integer duration;
@Column(name = "file_size", nullable = false)
private Long fileSize;
@Column(name = "video_path", nullable = false, length = 255)
private String videoPath;
}

View File

@@ -9,9 +9,9 @@ import java.time.LocalDateTime;
@Table(name = "users")
@Data
public class User {
@Id
@Column(name = "id", nullable = false, unique = true)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
private Long id;
@Column(name = "google_id", nullable = false, unique = true)
@@ -26,6 +26,9 @@ public class User {
@Column(name = "name", nullable = false)
private String name;
@Column(name = "role", nullable = false)
private Integer role; // 0: user, 1: admin
@Column(name = "created_at", nullable = false)
private LocalDateTime createdAt;
}

View File

@@ -0,0 +1,9 @@
package com.ddf.vodsystem.repositories;
import com.ddf.vodsystem.entities.Clip;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ClipRepository extends JpaRepository<Clip, Long> {
}