diff options
| author | Hafeez | 2018-04-15 18:22:09 +0100 |
|---|---|---|
| committer | Hafeez | 2018-04-15 18:22:09 +0100 |
| commit | 42e30930b635eb91bdb97d0a889081cd291f3740 (patch) | |
| tree | c355a2b8083f9f69beb0d424038e3460713f8b38 /src/db | |
| parent | started modifying file upload (diff) | |
| parent | fixed fetching current_user (diff) | |
| download | medicine-42e30930b635eb91bdb97d0a889081cd291f3740.tar.gz medicine-42e30930b635eb91bdb97d0a889081cd291f3740.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/User.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/db/model/User.ts b/src/db/model/User.ts index 171e899..3a0ef26 100644 --- a/src/db/model/User.ts +++ b/src/db/model/User.ts @@ -126,18 +126,20 @@ export default class User extends Model<User> { } public get fullInfo(): UserFullInfo { + console.log("fullinfo called") // 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 = []; } + console.log("2") 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? |
