55 lines
1.2 KiB
TypeScript
55 lines
1.2 KiB
TypeScript
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, PrimaryColumn, UpdateDateColumn } from "typeorm";
|
|
import { User } from "./users.entity";
|
|
import { Project } from "./projects.entity";
|
|
|
|
@Entity({ name: "tasks" })
|
|
export class Task {
|
|
@PrimaryColumn()
|
|
id: string;
|
|
|
|
@Column({ nullable: false })
|
|
creatorId: string;
|
|
|
|
@Column({ nullable: false })
|
|
userId: string;
|
|
|
|
@Column({ nullable: false })
|
|
projectId: string;
|
|
|
|
@Column({ nullable: false })
|
|
title: string;
|
|
|
|
@Column({ nullable: false })
|
|
description: string;
|
|
|
|
@Column({ nullable: false })
|
|
deadlineTime: Date;
|
|
|
|
@Column({ nullable: true })
|
|
rejectReason: string;
|
|
|
|
@Column({ nullable: true })
|
|
rejectDeadline: Date;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
|
|
@DeleteDateColumn()
|
|
deletedAt: Date;
|
|
|
|
@ManyToOne(() => User, (user) => user.createdTasks)
|
|
@JoinColumn({ name: "creatorId", referencedColumnName: "id" })
|
|
creator: User;
|
|
|
|
@ManyToOne(() => User, (user) => user.tasks)
|
|
@JoinColumn({ name: "userId", referencedColumnName: "id" })
|
|
user: User;
|
|
|
|
@ManyToOne(() => Project, (project) => project.tasks)
|
|
@JoinColumn({ name: "projectId", referencedColumnName: "id" })
|
|
project: Project;
|
|
}
|