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.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/db/model/File.ts b/src/db/model/File.ts
new file mode 100644
index 0000000..b88fef4
--- /dev/null
+++ b/src/db/model/File.ts
@@ -0,0 +1,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;
+}