import { Filmmaker } from 'src/filmmakers/entities/filmmaker.entity'; import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryColumn, UpdateDateColumn, } from 'typeorm'; import { Content } from './content.entity'; @Entity('casts') export class Cast { @PrimaryColumn() id: string; @Column({ nullable: true }) filmmakerId?: string; @PrimaryColumn() contentId: string; @Column({ nullable: true }) placeholderName: string; @Column() character: string; @Column() order: number; @Column({ nullable: true }) email: string; @CreateDateColumn({ type: 'timestamptz' }) createdAt: Date; @UpdateDateColumn({ type: 'timestamptz' }) updatedAt: Date; @ManyToOne(() => Filmmaker, (filmmaker) => filmmaker.castFilms) @JoinColumn({ name: 'filmmaker_id' }) filmmaker: Filmmaker; @ManyToOne(() => Content, (content) => content.cast) @JoinColumn({ name: 'content_id' }) content: Content; }