From 59ee72d9dae95cd038dd2c75f2a7be5f7a958dd0 Mon Sep 17 00:00:00 2001 From: Sendou Date: Tue, 7 Jan 2020 00:56:22 +0200 Subject: [PATCH] when updating build if build top false set it to null --- graphql-schemas/build.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/graphql-schemas/build.js b/graphql-schemas/build.js index a3765f6fe..e929c0bdc 100644 --- a/graphql-schemas/build.js +++ b/graphql-schemas/build.js @@ -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, })