aboutsummaryrefslogtreecommitdiff
path: root/src/db/model
diff options
context:
space:
mode:
authorjw2552018-04-21 23:01:58 +0100
committerjw2552018-04-21 23:01:58 +0100
commit7bfdc2cc7c5aa1aaed655c7ddd3a7c3cf38430e5 (patch)
tree15ac9f791daa89e88d8adde6e7775c205229602a /src/db/model
parentMerge branch 'trh/files' into trh/gets (diff)
downloadmedicine-7bfdc2cc7c5aa1aaed655c7ddd3a7c3cf38430e5.tar.gz
medicine-7bfdc2cc7c5aa1aaed655c7ddd3a7c3cf38430e5.zip

implimented moving and copying of files

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) {