From a8dc2c11e4d97c5d1251575a297719b77c9e4b23 Mon Sep 17 00:00:00 2001 From: dev-737 <73829355+dev-737@users.noreply.github.com> Date: Sat, 5 Oct 2024 20:33:21 +0530 Subject: [PATCH] refactor: new hubInvite schema --- prisma/schema.prisma | 9 +++++---- src/commands/slash/Main/hub/logging.ts | 1 - src/utils/HubLogger/Report.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d75daabc..47edca9b 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -122,7 +122,7 @@ model Hub { createdAt DateTime @default(now()) settings Int // each bit is a setting // all the stuff below is relations to other collections - invites hubInvites[] + invites HubInvite[] moderators HubModerator[] connections connectedList[] logConfig HubLogConfig[] @@ -146,12 +146,13 @@ model HubLogConfig { @@index([id, hubId]) } -model hubInvites { - id String @id @default(auto()) @map("_id") @db.ObjectId - code String @unique @default(nanoid(10)) +model HubInvite { + code String @id @default(nanoid(10)) @map("_id") expires DateTime hub Hub @relation(fields: [hubId], references: [id]) hubId String @db.ObjectId + + @@index([code, hubId]) } model originalMessages { diff --git a/src/commands/slash/Main/hub/logging.ts b/src/commands/slash/Main/hub/logging.ts index be0247a4..a3d38a37 100644 --- a/src/commands/slash/Main/hub/logging.ts +++ b/src/commands/slash/Main/hub/logging.ts @@ -81,7 +81,6 @@ export default class LoggingCommand extends HubCommand { 'You must set the logging channel before setting the role ID.', { ephemeral: true }, ); - return; } } diff --git a/src/utils/HubLogger/Report.ts b/src/utils/HubLogger/Report.ts index c8152eee..f3a2065e 100644 --- a/src/utils/HubLogger/Report.ts +++ b/src/utils/HubLogger/Report.ts @@ -88,7 +88,7 @@ export const sendHubReport = async ( const hub = await db.hub.findFirst({ where: { id: hubId }, include: { logConfig: true } }); if (!hub?.logConfig[0]?.reports?.channelId) return; - const { channelId: reportsChannelId, roleId: reportsRoleId } = hub?.logConfig[0]?.reports; + const { channelId: reportsChannelId, roleId: reportsRoleId } = hub.logConfig[0].reports; const server = await client.fetchGuild(serverId); const jumpLink = await genJumpLink(hubId, client, evidence?.messageId, reportsChannelId);