Fix schema issues

This commit is contained in:
Isaac 2022-08-08 22:38:54 +01:00
parent bc3ccdcb82
commit f419cbf967
No known key found for this signature in database
GPG Key ID: F4EAABEB0FFCC06A
7 changed files with 115 additions and 115 deletions

View File

@ -11,10 +11,11 @@ SUPER=
https://www.prisma.io/docs/reference/database-reference/supported-databases
![](https://static.eartharoid.me/k/22/08/02185801.png) - for user/create, slash/force-close and slash/move
![](https://static.eartharoid.me/k/22/08/02185801.png) - for user/create, slash/force-close, slash/claim, slash/release, and slash/move
menu question max length cannot be higher than question options
- TODO: topic and question answer values not encrypted?
- TODO: post stats
- TODO: settings bundle download
- TODO: update notifications
@ -29,4 +30,4 @@ creation requires an interaction:
- message:create(staff) -> category? -> DM (channel fallback) button -> topic or questions -> create
- DM -> guild? -> category? -> topic or questions -> create
- panel(interaction) -> topic or questions -> create
- panel(message) -> DM (channel fallback) button -> topic or questions -> create
- ~~panel(message) -> DM (channel fallback) button -> topic or questions -> create~~

View File

@ -20,16 +20,16 @@ model ArchivedChannel {
}
model ArchivedMessage {
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String @db.VarChar(19)
content String @db.Text
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
id String @id @db.VarChar(19)
referencedBy Ticket[] @relation("MessageReferencedByTicket")
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
ticketId String @db.VarChar(19)
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String @db.VarChar(19)
content Json
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
external Boolean @default(false)
id String @id @db.VarChar(19)
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
ticketId String @db.VarChar(19)
@@map("archivedMessages")
}
@ -68,30 +68,30 @@ model ArchivedUser {
}
model Category {
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
cooldown Int?
customTopic String?
description String
discordCategory String @db.VarChar(19)
emoji String
enableFeedback Boolean @default(false)
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
guildId String @db.VarChar(19)
id Int @id @default(autoincrement())
image String?
memberLimit Int @default(1)
name String
openingMessage String @db.Text
pingRoles Json @default("[]")
questions Question[]
ratelimit Int?
requiredRoles Json @default("[]")
requireTopic Boolean @default(false)
staffRoles Json
tickets Ticket[]
totalLimit Int @default(50)
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
cooldown Int?
customTopic String?
description String
discordCategory String @db.VarChar(19)
emoji String
enableFeedback Boolean @default(false)
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
guildId String @db.VarChar(19)
id Int @id @default(autoincrement())
image String?
memberLimit Int @default(1)
name String
openingMessage String @db.Text
pingRoles Json @default("[]")
questions Question[]
ratelimit Int?
requiredRoles Json @default("[]")
requireTopic Boolean @default(false)
staffRoles Json
tickets Ticket[]
totalLimit Int @default(50)
@@map("categories")
}
@ -210,11 +210,10 @@ model Ticket {
messageCount Int?
number Int
open Boolean @default(true)
openingMessage String @db.VarChar(19)
pinnedMessages Json @default("[]")
openingMessageId String @db.VarChar(19)
pinnedMessageIds Json @default("[]")
priority TicketPriority?
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
referencesMessage ArchivedMessage? @relation(name: "MessageReferencedByTicket", fields: [referencesMessageId], references: [id], onDelete: SetNull)
referencesMessageId String? @db.VarChar(19)
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
referencesTicketId String? @db.VarChar(19)

View File

@ -20,16 +20,16 @@ model ArchivedChannel {
}
model ArchivedMessage {
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String @db.VarChar(19)
content String @db.Text
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
id String @id @db.VarChar(19)
referencedBy Ticket[] @relation("MessageReferencedByTicket")
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
ticketId String @db.VarChar(19)
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String @db.VarChar(19)
content Json
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
external Boolean @default(false)
id String @id @db.VarChar(19)
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
ticketId String @db.VarChar(19)
@@map("archivedMessages")
}
@ -68,30 +68,30 @@ model ArchivedUser {
}
model Category {
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
cooldown Int?
customTopic String?
description String
discordCategory String @db.VarChar(19)
emoji String
enableFeedback Boolean @default(false)
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
guildId String @db.VarChar(19)
id Int @id @default(autoincrement())
image String?
memberLimit Int @default(1)
name String
openingMessage String @db.Text
pingRoles Json @default("[]")
questions Question[]
ratelimit Int?
requiredRoles Json @default("[]")
requireTopic Boolean @default(false)
staffRoles Json
tickets Ticket[]
totalLimit Int @default(50)
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
cooldown Int?
customTopic String?
description String
discordCategory String @db.VarChar(19)
emoji String
enableFeedback Boolean @default(false)
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
guildId String @db.VarChar(19)
id Int @id @default(autoincrement())
image String?
memberLimit Int @default(1)
name String
openingMessage String @db.Text
pingRoles Json @default("[]")
questions Question[]
ratelimit Int?
requiredRoles Json @default("[]")
requireTopic Boolean @default(false)
staffRoles Json
tickets Ticket[]
totalLimit Int @default(50)
@@map("categories")
}
@ -210,11 +210,10 @@ model Ticket {
messageCount Int?
number Int
open Boolean @default(true)
openingMessage String @db.VarChar(19)
pinnedMessages Json @default("[]")
openingMessageId String @db.VarChar(19)
pinnedMessageIds Json @default("[]")
priority TicketPriority?
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
referencesMessage ArchivedMessage? @relation(name: "MessageReferencedByTicket", fields: [referencesMessageId], references: [id], onDelete: SetNull)
referencesMessageId String? @db.VarChar(19)
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
referencesTicketId String? @db.VarChar(19)

View File

@ -20,16 +20,16 @@ model ArchivedChannel {
}
model ArchivedMessage {
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String
content String
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
id String @id
referencedBy Ticket[] @relation("MessageReferencedByTicket")
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
ticketId String
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String
content String
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
id String @id
external Boolean @default(false)
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
ticketId String
@@map("archivedMessages")
}
@ -68,30 +68,30 @@ model ArchivedUser {
}
model Category {
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
cooldown Int?
customTopic String?
description String
discordCategory String
emoji String
enableFeedback Boolean @default(false)
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
guildId String
id Int @id @default(autoincrement())
image String?
memberLimit Int @default(1)
name String
openingMessage String
pingRoles String @default("[]")
questions Question[]
ratelimit Int?
requiredRoles String @default("[]")
requireTopic Boolean @default(false)
staffRoles String
tickets Ticket[]
totalLimit Int @default(50)
channelName String
claiming Boolean @default(false)
createdAt DateTime @default(now())
cooldown Int?
customTopic String?
description String
discordCategory String
emoji String
enableFeedback Boolean @default(false)
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
guildId String
id Int @id @default(autoincrement())
image String?
memberLimit Int @default(1)
name String
openingMessage String
pingRoles String @default("[]")
questions Question[]
ratelimit Int?
requiredRoles String @default("[]")
requireTopic Boolean @default(false)
staffRoles String
tickets Ticket[]
totalLimit Int @default(50)
@@map("categories")
}
@ -210,11 +210,10 @@ model Ticket {
messageCount Int?
number Int
open Boolean @default(true)
openingMessage String
pinnedMessages String @default("[]")
openingMessageId String
pinnedMessageIds String @default("[]")
priority String?
referencedBy Ticket[] @relation("TicketsReferencedByTicket")
referencesMessage ArchivedMessage? @relation(name: "MessageReferencedByTicket", fields: [referencesMessageId], references: [id], onDelete: SetNull)
referencesMessageId String?
referencesTicket Ticket? @relation(name: "TicketsReferencedByTicket", fields: [referencesTicketId], references: [id], onDelete: SetNull)
referencesTicketId String?

View File

@ -6,7 +6,7 @@ const jsonFields = [
'blocklist',
'workingHours',
'options',
'pinnedMessages',
'pinnedMessageIds',
];
const traverse = (obj, action) => {

View File

@ -371,7 +371,7 @@ module.exports = class TicketManager {
guild: { connect: { id: category.guild.id } },
id: channel.id,
number,
openingMessage: sent.id,
openingMessageId: sent.id,
topic,
};
if (referencesTicket) data.referencesTicket = { connect: { id: referencesTicket } };

View File

@ -179,7 +179,9 @@ module.exports = class extends Listener {
} else {
// TODO: archive messages in tickets
// TODO: first response
// TODO: lastMessageAt
// TODO: auto tag
// TODO: staff status alert, working hours alerts
}
}
};