diff options
| author | josh97josh | 2018-04-20 11:53:37 +0100 |
|---|---|---|
| committer | josh97josh | 2018-04-20 11:53:37 +0100 |
| commit | af7934c3852bbde45210dd0c475817b8f20ddefc (patch) | |
| tree | 39ae972ea75cfc0033161b54eb26192bec14d353 /src/db/model/File.ts | |
| parent | small fixes (diff) | |
| parent | reduced # of failing tests (diff) | |
| download | medicine-af7934c3852bbde45210dd0c475817b8f20ddefc.tar.gz medicine-af7934c3852bbde45210dd0c475817b8f20ddefc.zip | |
Merge branch ‘trh/gets’ of ssh://localhost:2222/cs3099group-be-4/project-code into trh/gets
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 { |
