add migration and entities for uploads upload_zk upload_hotlink.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { Column, CreateDateColumn, Entity, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { UploadMode } from '../types/UploadMode';
|
||||
import { UploadHotlink } from './UploadHotlink';
|
||||
import { UploadZk } from './UploadZk';
|
||||
|
||||
@Entity('uploads')
|
||||
export class Upload {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column({ type: 'enum', enum: UploadMode })
|
||||
mode: UploadMode;
|
||||
|
||||
@Column({ type: 'text' })
|
||||
storagePath: string;
|
||||
|
||||
@Column({ type: 'bytea' })
|
||||
iv: Buffer;
|
||||
|
||||
@Column({ type: 'int', nullable: true })
|
||||
maxViews: number | null;
|
||||
|
||||
@Column({ type: 'int', default: 0 })
|
||||
viewCount: number;
|
||||
|
||||
@Column()
|
||||
deleteTokenHash: string;
|
||||
|
||||
@OneToOne(() => UploadZk, zk => zk.upload)
|
||||
zk: UploadZk | null;
|
||||
|
||||
@OneToOne(() => UploadHotlink, hotlink => hotlink.upload)
|
||||
hotlink: UploadHotlink | null;
|
||||
|
||||
@Column({ type: 'timestamptz', nullable: true })
|
||||
lastViewedAt: Date | null;
|
||||
|
||||
@Column({ type: 'timestamptz', nullable: true })
|
||||
expiresAt: Date | null;
|
||||
|
||||
@CreateDateColumn({ type: 'timestamptz' })
|
||||
createdAt: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user