aboutsummaryrefslogtreecommitdiff
path: root/src/db/model/File.ts
diff options
context:
space:
mode:
authorjw2552018-04-19 16:26:46 +0100
committerjw2552018-04-19 16:26:46 +0100
commitb56d886000a70898dcc54c06bd265fa379f44ac4 (patch)
tree7de1d7dd6479b979e0c6d33edf91fa5ae7b67cc5 /src/db/model/File.ts
parentProject Owners added (diff)
parentAdd CORS support (diff)
downloadmedicine-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.ts32
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 {