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

This commit is contained in:
2021-01-16 20:59:48 +01:00
parent de36a24191
commit 6e6979cfe3
4 changed files with 19 additions and 20 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: ResponseUserGroup[];
groups: UserGroup[];
/**
* The user's permissions.
@@ -90,12 +90,10 @@ export class ResponseUser extends ResponsePrincipal {
this.username = user.username;
this.enabled = user.enabled;
this.profilePic = user.profilePic;
if (user.groups) {
for (let group of user.groups) {
this.groups.push(group.toResponse());
}
}
this.groups = user.groups;
this.permissions = user.allPermissions;
this.groups.forEach(function (g) { delete g.permissions });
if (this.groups) {
this.groups.forEach(function (g) { delete g.permissions });
}
}
}