Skip to content

Commit

Permalink
Merge pull request #57 from net-tech/revert/use-include
Browse files Browse the repository at this point in the history
  • Loading branch information
net-tech authored Nov 21, 2023
2 parents 5efb4f5 + 15ba4e7 commit 8ce8225
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/commands/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
16 changes: 4 additions & 12 deletions src/util/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +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,
select: Prisma.GuildSelect | true
) => {
export const getGuildData = async (guildId: string) => {
const guildData = await prisma.guild.upsert({
where: {
id: guildId
Expand All @@ -22,14 +19,9 @@ export const getGuildData = async (
create: {
id: guildId
},
select: select
? {
roles: true
}
: {
roles: true,
...(select as Prisma.GuildSelect)
}
include: {
roles: true
}
})
return guildData
}
Expand Down

0 comments on commit 8ce8225

Please sign in to comment.