Nicolas Giard
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
0 deletions
-
server/graph/resolvers/group.js
|
|
@ -34,6 +34,13 @@ module.exports = { |
|
|
|
if (!usr) { |
|
|
|
throw new gql.GraphQLError('Invalid User ID') |
|
|
|
} |
|
|
|
const relExist = await WIKI.models.knex('userGroups').where({ |
|
|
|
userId: args.userId, |
|
|
|
groupId: args.groupId |
|
|
|
}).first() |
|
|
|
if (relExist) { |
|
|
|
throw new gql.GraphQLError('User is already assigned to group.') |
|
|
|
} |
|
|
|
await grp.$relatedQuery('users').relate(usr.id) |
|
|
|
return { |
|
|
|
responseResult: graphHelper.generateSuccess('User has been assigned to group.') |
|
|
|