diff options
| author | Tom Harley | 2018-02-08 01:21:10 +0000 |
|---|---|---|
| committer | Tom Harley | 2018-02-08 01:21:10 +0000 |
| commit | 50712e8c6cedaa9900897acc187a1237c76f5887 (patch) | |
| tree | a03608558a82caaf1ba3dc352b7fdad15e89a6b9 /src/db/model/File.ts | |
| parent | fixed runmepostgres.sh to actually use PGDIR (diff) | |
| download | medicine-50712e8c6cedaa9900897acc187a1237c76f5887.tar.gz medicine-50712e8c6cedaa9900897acc187a1237c76f5887.zip | |
further work on ORM model
Diffstat (limited to 'src/db/model/File.ts')
| -rw-r--r-- | src/db/model/File.ts | 32 |
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; +} |
