when updating build if build top false set it to null

This commit is contained in:
Sendou
2020-01-07 00:56:22 +02:00
parent b2976d1eb1
commit 59ee72d9da

View File

@@ -271,7 +271,10 @@ const resolvers = {
if (ctx.user.discord_id !== build.discord_id)
throw new AuthenticationError("no privileges to edit the build")
await Build.findByIdAndUpdate(build._id, { ...args }).catch(e => {
await Build.findByIdAndUpdate(build._id, {
...args,
top: build.top ? build.top : null,
}).catch(e => {
throw new UserInputError(error.message, {
invalidArgs: args,
})