Skip to content

Commit 8c045c5

Browse files
committed
Fix missing input validation for user resolver
1 parent 9e43efc commit 8c045c5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

api/resolvers/user.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ export default {
134134
},
135135
user: async (parent, { id, name }, { models }) => {
136136
if (id) id = Number(id)
137+
if (!id && !name) {
138+
throw new GqlInputError('id or name is required')
139+
}
137140
return await models.user.findUnique({ where: { id, name } })
138141
},
139142
users: async (parent, args, { models }) =>

0 commit comments

Comments
 (0)