diff options
| author | jw255 | 2018-04-19 16:26:46 +0100 |
|---|---|---|
| committer | jw255 | 2018-04-19 16:26:46 +0100 |
| commit | b56d886000a70898dcc54c06bd265fa379f44ac4 (patch) | |
| tree | 7de1d7dd6479b979e0c6d33edf91fa5ae7b67cc5 /src/db/model/File.ts | |
| parent | Project Owners added (diff) | |
| parent | Add CORS support (diff) | |
| download | medicine-b56d886000a70898dcc54c06bd265fa379f44ac4.tar.gz medicine-b56d886000a70898dcc54c06bd265fa379f44ac4.zip | |
Merge branch ‘trh/gets’ into ‘jl247/permissions’
Conflicts:
src/FileRouter.ts
Diffstat (limited to 'src/db/model/File.ts')
| -rw-r--r-- | src/db/model/File.ts | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/db/model/File.ts b/src/db/model/File.ts index 4026b85..8a12431 100644 --- a/src/db/model/File.ts +++ b/src/db/model/File.ts @@ -5,11 +5,29 @@ import { default as User } from './User'; import { FileTypeName, mimes } from '../../files'; +/* + * attributes: + * - nameInternal + * - fullPathInternal + * - uuid + * - type + * - size + * - parentFolderId + * - containedFilesInternal + * - creatorName + * - creator + * - rootFolderOf + * - uploadDate + * - modifyDate + * - status + * - metadataInternal +*/ + @Table export default class File extends Model<File> { @AllowNull @Column - private nameInternal!: string; + public nameInternal!: string; @AllowNull @Column @@ -67,10 +85,14 @@ export default class File extends Model<File> { public set name(name: string) { this.nameInternal = name; - this.fullPathInternal = this.fullPathInternal.substring( - 0, - this.fullPathInternal.lastIndexOf('/') + 1 - ) + this.name; + if (this.fullPathInternal) { + this.fullPathInternal = this.fullPathInternal.substring( + 0, + this.fullPathInternal.lastIndexOf('/') + 1 + ) + this.name; + } else { + this.fullPathInternal = this.name; + } } public get fullPath(): string { |
