diff --git a/examples/createGuildCounter.ts b/examples/createGuildCounter.ts new file mode 100644 index 0000000..0f87938 --- /dev/null +++ b/examples/createGuildCounter.ts @@ -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, + }, + }, + }, + }, +}); diff --git a/examples/findUniqueChannelCounter.ts b/examples/findUniqueChannelCounter.ts new file mode 100644 index 0000000..2639bce --- /dev/null +++ b/examples/findUniqueChannelCounter.ts @@ -0,0 +1,8 @@ +const channelCounter = await prisma.guildCounter.findUnique({ + where: { + guildId_channelId: { + guildId: guild.id, + channelId: discordChannel.id, + }, + }, +});