🧑‍💻 Added more Prisma Examples

This commit is contained in:
Axel Olausson Holtenäs 2022-10-19 10:21:33 +02:00
parent 999612086b
commit 145a8b3e9c
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,24 @@
const createGuildCounter = await prisma.guildCounter.upsert({
where: {
guildId_channelId: {
guildId: guild.id,
channelId: discordChannel.id,
},
},
update: {},
create: {
channelId: discordChannel.id,
triggerWord,
count: startValue || 0,
guild: {
connectOrCreate: {
create: {
id: guild.id,
},
where: {
id: guild.id,
},
},
},
},
});

View file

@ -0,0 +1,8 @@
const channelCounter = await prisma.guildCounter.findUnique({
where: {
guildId_channelId: {
guildId: guild.id,
channelId: discordChannel.id,
},
},
});