diff --git a/src/models/actions/update/UpdateUser.ts b/src/models/actions/update/UpdateUser.ts index 2797b34..c9dedcf 100644 --- a/src/models/actions/update/UpdateUser.ts +++ b/src/models/actions/update/UpdateUser.ts @@ -79,11 +79,10 @@ export class UpdateUser { enabled: boolean = true; /** - * The updated user's groups. - * This just has to contain the group's id - everything else won't be changed. + * The updated user's groups' ids. */ @IsOptional() - groups?: UserGroup[] + groups?: number | number[] /** * The user's profile pic (or rather a url pointing to it). @@ -124,7 +123,7 @@ export class UpdateUser { } /** - * Loads the updated user's groups based on their ids. + * Get's all groups for this user by their id's; */ public async getGroups() { if (!this.groups) { return null; } @@ -133,7 +132,7 @@ export class UpdateUser { this.groups = [this.groups] } for (let group of this.groups) { - let found = await getConnectionManager().get().getRepository(UserGroup).findOne({ id: group.id }); + let found = await getConnectionManager().get().getRepository(UserGroup).findOne({ id: group }); if (!found) { throw new UserGroupNotFoundError(); } groups.push(found); }