Hotfix: Missing relation bug
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-01-16 20:32:40 +01:00
parent 3766899c83
commit b167ba07f7
3 changed files with 15 additions and 8 deletions

View File

@@ -6,8 +6,8 @@ import {
IsString
} from "class-validator";
import { User } from '../entities/User';
import { UserGroup } from '../entities/UserGroup';
import { ResponsePrincipal } from './ResponsePrincipal';
import { ResponseUserGroup } from './ResponseUserGroup';
/**
* Defines the user response.
@@ -66,7 +66,7 @@ export class ResponseUser extends ResponsePrincipal {
*/
@IsArray()
@IsOptional()
groups: UserGroup[];
groups: ResponseUserGroup[];
/**
* The user's permissions.
@@ -90,7 +90,11 @@ export class ResponseUser extends ResponsePrincipal {
this.username = user.username;
this.enabled = user.enabled;
this.profilePic = user.profilePic;
this.groups = user.groups;
if (user.groups) {
for (let group of user.groups) {
this.groups.push(group.toResponse());
}
}
this.permissions = user.allPermissions;
this.groups.forEach(function (g) { delete g.permissions });
}