video.entity.ts54 lines, 1.0 KB
| 1 | import { |
| 2 | Column, |
| 3 | CreateDateColumn, |
| 4 | Entity, |
| 5 | ManyToOne, |
| 6 | OneToOne, |
| 7 | PrimaryGeneratedColumn, |
| 8 | UpdateDateColumn, |
| 9 | } from "typeorm"; |
| 10 | import { User } from "./user.entity"; |
| 11 | import { Transcription } from "./transcription.entity"; |
| 12 | import { Analysis } from "./analysis.entity"; |
| 13 | |
| 14 | @Entity() |
| 15 | export class Video { |
| 16 | @PrimaryGeneratedColumn("uuid") |
| 17 | id: string; |
| 18 | |
| 19 | @Column() |
| 20 | url: string; |
| 21 | |
| 22 | @Column() |
| 23 | title: string; |
| 24 | |
| 25 | @Column({ type: "text", nullable: true }) |
| 26 | description: string; |
| 27 | |
| 28 | @Column() |
| 29 | duration: number; |
| 30 | |
| 31 | @Column() |
| 32 | author: string; |
| 33 | |
| 34 | @Column({ type: "text", nullable: true }) |
| 35 | thumbnail: string; |
| 36 | |
| 37 | @Column({ default: "pending" }) |
| 38 | status: "pending" | "processing" | "completed" | "failed"; |
| 39 | |
| 40 | @ManyToOne(() => User, (user) => user.videos, { nullable: false }) |
| 41 | user: User; |
| 42 | |
| 43 | @OneToOne(() => Transcription, (transcription) => transcription.video) |
| 44 | transcription: Transcription; |
| 45 | |
| 46 | @OneToOne(() => Analysis, (analysis) => analysis.video) |
| 47 | analysis: Analysis; |
| 48 | |
| 49 | @CreateDateColumn() |
| 50 | createdAt: Date; |
| 51 | |
| 52 | @UpdateDateColumn() |
| 53 | updatedAt: Date; |
| 54 | } |