46 lines
993 B
TypeScript
46 lines
993 B
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { Branch } from './branch.entity';
|
|
import { TaskStatus } from '../enums/task-status.enum';
|
|
|
|
@Entity('tasks')
|
|
export class Task {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ type: 'uuid' })
|
|
branchId: string;
|
|
|
|
@ManyToOne(() => Branch, { onDelete: 'RESTRICT' })
|
|
@JoinColumn({ name: 'branchId' })
|
|
branch: Branch;
|
|
|
|
@Column({ type: 'varchar', length: 180 })
|
|
title: string;
|
|
|
|
@Column({ type: 'text', nullable: true })
|
|
description: string | null;
|
|
|
|
@Column({ type: 'enum', enum: TaskStatus, default: TaskStatus.PENDING })
|
|
status: TaskStatus;
|
|
|
|
@Column({ type: 'timestamptz', nullable: true })
|
|
doneAt: Date | null;
|
|
|
|
@Column({ type: 'uuid', nullable: true })
|
|
doneBy: string | null;
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
}
|