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

@ -22,12 +22,12 @@ model ArchivedChannel {
model ArchivedMessage {
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String @db.VarChar(19)
content String @db.Text
content Json
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
external 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)
@ -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

@ -22,12 +22,12 @@ model ArchivedChannel {
model ArchivedMessage {
author ArchivedUser @relation(fields: [ticketId, authorId], references: [ticketId, userId], onDelete: Cascade)
authorId String @db.VarChar(19)
content String @db.Text
content Json
createdAt DateTime @default(now())
deleted Boolean @default(false)
edited Boolean @default(false)
external 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)
@ -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

@ -27,7 +27,7 @@ model ArchivedMessage {
deleted Boolean @default(false)
edited Boolean @default(false)
id String @id
referencedBy Ticket[] @relation("MessageReferencedByTicket")
external Boolean @default(false)
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
ticketId String
@ -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
}
}
};