aboutsummaryrefslogtreecommitdiff
path: root/src/db/model/File.ts
blob: b88fef41c0832d3e3f9922b8ec8c462d40bc9782 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * from 'sequelize-typescript';

@Table
export default class File extends Model<File> {
  @Column
  @Unique
  @NotNull
  name: string;

  @Column
  @PrimaryKey
  uuid: string;

  @Column
  mimetype: string;

  @Column
  @ForeignKey(() => File)
  parentFolderId: string;

  @BelongsTo(() => File)
  parentFolder: File;

  @HasMany(() => File)
  containedFiles: File[];

  @CreatedAt
  uploadDate: Date;

  @UpdatedAt
  modifyDate: Date;
}