2023-10-19 17:17:48 +09:00

53 lines
1.6 KiB
TypeScript

import { AudioOptionItem } from '../../../repositories/audio_option_items/entity/audio_option_item.entity';
import { AudioFile } from '../../../repositories/audio_files/entity/audio_file.entity';
import { User } from '../../../repositories/users/entity/user.entity';
import { TemplateFile } from '../../template_files/entity/template_file.entity';
import {
Entity,
Column,
PrimaryGeneratedColumn,
OneToOne,
JoinColumn,
OneToMany,
ManyToOne,
} from 'typeorm';
@Entity({ name: 'tasks' })
export class Task {
@PrimaryGeneratedColumn()
id: number;
@Column()
job_number: string;
@Column()
account_id: number;
@Column({ nullable: true, type: 'tinyint' })
is_job_number_enabled: boolean | null;
@Column()
audio_file_id: number;
@Column()
status: string;
@Column({ nullable: true, type: 'int' })
typist_user_id: number | null;
@Column()
priority: string;
@Column({ nullable: true, type: 'int' })
template_file_id: number | null;
@Column({ nullable: true, type: 'datetime' })
started_at: Date | null;
@Column({ nullable: true, type: 'datetime' })
finished_at: Date | null;
@Column({})
created_at: Date;
@OneToOne(() => AudioFile, (audiofile) => audiofile.task)
@JoinColumn({ name: 'audio_file_id' })
file: AudioFile | null;
@OneToMany(() => AudioOptionItem, (option) => option.task)
option_items: AudioOptionItem[] | null;
@OneToOne(() => User, (user) => user.id)
@JoinColumn({ name: 'typist_user_id' })
typist_user: User | null;
@ManyToOne(() => TemplateFile, (templateFile) => templateFile.id)
@JoinColumn({ name: 'template_file_id' })
template_file: TemplateFile | null;
}