aboutsummaryrefslogtreecommitdiff
path: root/src/db/model
diff options
context:
space:
mode:
authorTom Harley2018-04-21 23:02:58 +0100
committerTom Harley2018-04-21 23:02:58 +0100
commit661ee231f676c642545b38ea43568acef777d3a7 (patch)
treeabe2f305de31881e613d97a22969ceec1585a2d7 /src/db/model
parentAdd support for tabular files (diff)
parentimplimented moving and copying of files (diff)
downloadmedicine-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.ts7
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) {