aboutsummaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorTom Harley2018-04-17 17:03:14 +0100
committerTom Harley2018-04-17 17:03:14 +0100
commit44c14c13bdd7ad91a119564622b811cc70147de8 (patch)
tree318420a6bc570bcd3c990d387411e7a205a4e677 /src/db
parentMerge branch 'trh/gets' of gitlab.cs.st-andrews.ac.uk:cs3099group-be-4/projec... (diff)
parentWorld War Files - changed precondition + filled addSubFileToFolder() function... (diff)
downloadmedicine-44c14c13bdd7ad91a119564622b811cc70147de8.tar.gz
medicine-44c14c13bdd7ad91a119564622b811cc70147de8.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')
-rw-r--r--src/db/model/File.ts18
-rw-r--r--src/db/model/User.ts8
2 files changed, 22 insertions, 4 deletions
diff --git a/src/db/model/File.ts b/src/db/model/File.ts
index 4026b85..193a785 100644
--- a/src/db/model/File.ts
+++ b/src/db/model/File.ts
@@ -5,6 +5,24 @@ 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
diff --git a/src/db/model/User.ts b/src/db/model/User.ts
index 171e899..73d2356 100644
--- a/src/db/model/User.ts
+++ b/src/db/model/User.ts
@@ -128,16 +128,16 @@ export default class User extends Model<User> {
public get fullInfo(): UserFullInfo {
// FIXME: Fetch these things if they aren't already present
if (this.userGroups === undefined) {
- throw new Error('userGroups undefined');
+ this.userGroups = [];
} else if (this.projects === undefined) {
- throw new Error('projects undefined');
+ this.projects = [];
}
return {
username : this.username,
- privileges: this.userGroups
+ privileges: this.userGroups!
.filter((ug: UserGroup): boolean => ug.name !== null)
.map((ug: UserGroup): string => ug.name as string),
- projects : this.projects.map(
+ projects : this.projects!.map(
(p: Project): ProjectInfo => this.getProjectInfo(p)
),
// TODO: Check if we have anything to use these for yet?