fix: remove unnecessary code for updating questions

This commit is contained in:
Isaac 2023-06-18 23:58:30 +01:00
parent 6593250945
commit 6e5ccd118d
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -1,6 +1,5 @@
const { logAdminEvent } = require('../../../../../../../lib/logging'); const { logAdminEvent } = require('../../../../../../../lib/logging');
const { updateStaffRoles } = require('../../../../../../../lib/users'); const { updateStaffRoles } = require('../../../../../../../lib/users');
const { randomUUID } = require('crypto');
const { ApplicationCommandPermissionType } = require('discord.js'); const { ApplicationCommandPermissionType } = require('discord.js');
module.exports.delete = fastify => ({ module.exports.delete = fastify => ({
@ -128,14 +127,11 @@ module.exports.patch = fastify => ({
data: { data: {
...data, ...data,
questions: { questions: {
upsert: data.questions?.map(q => { upsert: data.questions?.map(q => ({
if (!q.id) q.id = randomUUID(); create: q,
return { update: q,
create: q, where: { id: q.id },
update: q, })),
where: { id: q.id },
};
}),
}, },
}, },
select, select,