38 lines
626 B
TypeScript
38 lines
626 B
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { User } from '../user/user.entity';
|
|
|
|
@Entity()
|
|
export class Upload {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ nullable: false })
|
|
original_name: string;
|
|
|
|
@Column({ nullable: false })
|
|
mimetype: string;
|
|
|
|
@Column({ nullable: false })
|
|
file: string;
|
|
|
|
@ManyToOne(() => User, {
|
|
nullable: true,
|
|
onDelete: 'SET NULL',
|
|
onUpdate: 'CASCADE',
|
|
})
|
|
uploader: User;
|
|
|
|
@CreateDateColumn()
|
|
public created_at: Date;
|
|
|
|
@UpdateDateColumn()
|
|
public updated_at: Date;
|
|
}
|