From 6e5ccd118def5e1efd76cc3cf70fb62f11119408 Mon Sep 17 00:00:00 2001 From: Isaac Date: Sun, 18 Jun 2023 23:58:30 +0100 Subject: [PATCH] fix: remove unnecessary code for updating questions --- .../guilds/[guild]/categories/[category]/index.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/routes/api/admin/guilds/[guild]/categories/[category]/index.js b/src/routes/api/admin/guilds/[guild]/categories/[category]/index.js index 413cfad..6e70ebf 100644 --- a/src/routes/api/admin/guilds/[guild]/categories/[category]/index.js +++ b/src/routes/api/admin/guilds/[guild]/categories/[category]/index.js @@ -1,6 +1,5 @@ const { logAdminEvent } = require('../../../../../../../lib/logging'); const { updateStaffRoles } = require('../../../../../../../lib/users'); -const { randomUUID } = require('crypto'); const { ApplicationCommandPermissionType } = require('discord.js'); module.exports.delete = fastify => ({ @@ -128,14 +127,11 @@ module.exports.patch = fastify => ({ data: { ...data, questions: { - upsert: data.questions?.map(q => { - if (!q.id) q.id = randomUUID(); - return { - create: q, - update: q, - where: { id: q.id }, - }; - }), + upsert: data.questions?.map(q => ({ + create: q, + update: q, + where: { id: q.id }, + })), }, }, select,