diff options
| author | Tom Harley | 2018-04-21 23:02:58 +0100 |
|---|---|---|
| committer | Tom Harley | 2018-04-21 23:02:58 +0100 |
| commit | 661ee231f676c642545b38ea43568acef777d3a7 (patch) | |
| tree | abe2f305de31881e613d97a22969ceec1585a2d7 /src/db/model | |
| parent | Add support for tabular files (diff) | |
| parent | implimented moving and copying of files (diff) | |
| download | medicine-661ee231f676c642545b38ea43568acef777d3a7.tar.gz medicine-661ee231f676c642545b38ea43568acef777d3a7.zip | |
Merge branch ‘trh/gets’ of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/project-code into trh/gets
Diffstat (limited to 'src/db/model')
| -rw-r--r-- | src/db/model/File.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/db/model/File.ts b/src/db/model/File.ts index 6b71f3d..89415b7 100644 --- a/src/db/model/File.ts +++ b/src/db/model/File.ts @@ -116,7 +116,8 @@ export default class File extends Model<File> { } public get metadata(): Metadata { - return JSON.parse(this.metadataInternal) || INITIAL_METADATA; + return !!(this.metadataInternal) ? JSON.parse(this.metadataInternal) + : INITIAL_METADATA; } public set metadata(md: Metadata) { @@ -128,6 +129,10 @@ export default class File extends Model<File> { if (newMD.version !== oldMD.version + 1) { throw new RequestError(400, 'invalid_request'); } + this.metadataInternal = JSON.stringify(newMD); + } + public setMetadataInternal(md: Metadata): void { + this.metadataInternal = JSON.stringify(md); } public set mimetype(mime: string) { |
