aboutsummaryrefslogtreecommitdiff
path: root/src/db/model/File.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/model/File.ts')
-rw-r--r--src/db/model/File.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/db/model/File.ts b/src/db/model/File.ts
new file mode 100644
index 0000000..bb5759d
--- /dev/null
+++ b/src/db/model/File.ts
@@ -0,0 +1,48 @@
+import * from 'sequelize-typescript';
+import { default as User } from './User';
+import { default as Project } from './Project';
+
+@Table
+export default class File extends Model<File> {
+ @Column
+ @Unique
+ name: string;
+
+ @Column
+ @PrimaryKey
+ uuid: string;
+
+ @Column
+ mimetype: string;
+
+ @Column
+ @ForeignKey(() => File)
+ @AllowNull
+ parentFolderId: string;
+
+ @BelongsTo(() => File)
+ @AllowNull
+ parentFolder: File;
+
+ @HasMany(() => File)
+ containedFiles: File[];
+
+ @Column
+ @ForeignKey(() => User)
+ @AllowNull
+ creatorName: string;
+
+ @BelongsTo(() => User)
+ creator: User;
+
+ @BelongsTo(() => Project)
+ rootFolderOf: Project;
+
+ @Column
+ @CreatedAt
+ uploadDate: Date;
+
+ @Column
+ @UpdatedAt
+ modifyDate: Date;
+}