Skip to content

Commit

Permalink
fix issuer stuff
Browse files Browse the repository at this point in the history
Signed-off-by: IThundxr <[email protected]>
  • Loading branch information
IThundxr committed Aug 7, 2023
1 parent 9bf951f commit 9f5c30a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions prisma/migrations/20230807165137_removeissuer/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- DropForeignKey
ALTER TABLE "Warning" DROP CONSTRAINT "Warning_issuerId_fkey";
6 changes: 2 additions & 4 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ datasource db {
}

model User {
id String @id @unique
warnings Warning[]
issuedWarnings Warning[] @relation("Issuer")
id String @id @unique
warnings Warning[]
}

model Warning {
id String @id @default(uuid())
reason String
timestamp DateTime @default(now())
issuer User @relation("Issuer", fields: [issuerId], references: [id])
issuerId String
User User @relation(fields: [userId], references: [id])
userId String
Expand Down
4 changes: 1 addition & 3 deletions src/commands/moderation/warn.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ export const warnCommand: Command = {
await prisma.warning.create({
data: {
reason: reason.value as string,
issuer: {
connect: { id: interaction.user.id },
},
issuerId: interaction.user.id,
User: {
connect: { id: member.id },
},
Expand Down

0 comments on commit 9f5c30a

Please sign in to comment.