| 1 | import { |
| 2 | Column, |
| 3 | CreateDateColumn, |
| 4 | Entity, |
| 5 | JoinColumn, |
| 6 | OneToOne, |
| 7 | PrimaryGeneratedColumn, |
| 8 | UpdateDateColumn, |
| 9 | } from "typeorm"; |
| 10 | import { Video } from "./video.entity"; |
| 11 | import { Chapter } from "../services/ai.service"; |
| 12 | |
| 13 | @Entity() |
| 14 | export class Analysis { |
| 15 | @PrimaryGeneratedColumn("uuid") |
| 16 | id: string; |
| 17 | |
| 18 | @Column({ type: "text" }) |
| 19 | summary: string; |
| 20 | |
| 21 | @Column("text", { array: true }) |
| 22 | keyPoints: string[]; |
| 23 | |
| 24 | @Column({ |
| 25 | type: "enum", |
| 26 | enum: ["positive", "negative", "neutral"], |
| 27 | default: "neutral", |
| 28 | }) |
| 29 | sentiment: "positive" | "negative" | "neutral"; |
| 30 | |
| 31 | @Column({ type: "text", array: true }) |
| 32 | topics: string[]; |
| 33 | |
| 34 | @Column({ type: "text", array: true }) |
| 35 | suggestedTags: string[]; |
| 36 | |
| 37 | @Column({ type: "jsonb", nullable: true }) |
| 38 | chapters: Chapter[]; |
| 39 | |
| 40 | @OneToOne(() => Video, (video) => video.analysis) |
| 41 | @JoinColumn() |
| 42 | video: Video; |
| 43 | |
| 44 | @CreateDateColumn() |
| 45 | createdAt: Date; |
| 46 | |
| 47 | @UpdateDateColumn() |
| 48 | updatedAt: Date; |
| 49 | } |