Skip to content

Commit b763308

Browse files
committed
fix: add group connect
1 parent d954422 commit b763308

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

apps/api/src/users/users.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,14 @@ export class UsersService {
107107
return user;
108108
}
109109

110-
async updateById(id: string, data: UpdateUserDto, { ability }: EntityOperationOptions = {}) {
110+
async updateById(id: string, { groupIds, ...data }: UpdateUserDto, { ability }: EntityOperationOptions = {}) {
111111
return this.userModel.update({
112-
data,
112+
data: {
113+
...data,
114+
groups: {
115+
connect: groupIds?.map((id) => ({ id }))
116+
}
117+
},
113118
where: { AND: [accessibleQuery(ability, 'update', 'User')], id }
114119
});
115120
}

0 commit comments

Comments
 (0)