From c6be241a99db0d12bb0ba7170e24cd0a48dda5fe Mon Sep 17 00:00:00 2001 From: net-tech Date: Tue, 21 Nov 2023 22:28:22 +0100 Subject: [PATCH 1/2] revert: remove include Signed-off-by: net-tech --- src/commands/settings.ts | 2 +- src/util/database.ts | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/commands/settings.ts b/src/commands/settings.ts index bd56b21..08c7f93 100644 --- a/src/commands/settings.ts +++ b/src/commands/settings.ts @@ -169,7 +169,7 @@ export default { return }) - const guildData = await getGuildData(interaction.guild.id, true) + const guildData = await getGuildData(interaction.guild.id) const settingsEmbed = new EmbedBuilder() .setTitle("Server Settings") diff --git a/src/util/database.ts b/src/util/database.ts index a7c727e..c6ac5c0 100644 --- a/src/util/database.ts +++ b/src/util/database.ts @@ -12,7 +12,6 @@ export const prisma = new PrismaClient({ */ export const getGuildData = async ( guildId: string, - select: Prisma.GuildSelect | true ) => { const guildData = await prisma.guild.upsert({ where: { @@ -22,14 +21,9 @@ export const getGuildData = async ( create: { id: guildId }, - select: select - ? { - roles: true - } - : { - roles: true, - ...(select as Prisma.GuildSelect) - } + include: { + roles: true + } }) return guildData } From 15ba4e74c9c756281e23c98f230723ef6a4f4647 Mon Sep 17 00:00:00 2001 From: net-tech Date: Tue, 21 Nov 2023 22:29:25 +0100 Subject: [PATCH 2/2] style: format Signed-off-by: net-tech --- src/util/database.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util/database.ts b/src/util/database.ts index c6ac5c0..e8efa35 100644 --- a/src/util/database.ts +++ b/src/util/database.ts @@ -10,9 +10,7 @@ export const prisma = new PrismaClient({ * @param select - The fields to select from the database. If true, all fields will be selected, including the `roles` field. If false, roles will still be selected. * @returns The data for the guild */ -export const getGuildData = async ( - guildId: string, -) => { +export const getGuildData = async (guildId: string) => { const guildData = await prisma.guild.upsert({ where: { id: guildId