mirror of
https://github.com/System-End/nephthys.git
synced 2026-04-19 22:05:12 +00:00
* Update DB when unthreaded messages are deleted * Add required library libatomic1 to Dockerfile (#71) * Handle quick message deletions This is a quick and dirty way to handle the bug, but it works. I also realised that handle_question_deletion() doesn't delete it in #tickets * Create a system for tracking bot messages attached to tickets * Ensure resolved message is added to userFacingMsgs TODO I''ll need to make a function that all the macros can use to send a user-facing message * Add a reply_to_ticket() helper for updating the DB while replying to a ticket * Fix type errors in reply_to_ticket() * Use reply_to_ticket when resolving tickets * Fix type errors in message.py * Create delete_replies_to_ticket() * Remove unused parameter in delete_replies_to_ticket * Rename BotMessage.msgTs to BotMessage.ts * Write a stub delete_and_clean_up_ticket function * Partially implement delete_and_clean_up_ticket * Delete "ticket" message in delete_and_clean_up_ticket() * Use the new ticket methods where appropriate * Make function name clearer ("delete_bot_replies") * Log if a question is deleted but not present in DB * Fix error when normal messages are deleted * Actually include userFacingMsgs in the query when deleting bot replies * Add success heartbeat to delete queue * Document the deletion queue needing workspace admin * Don't use delete queue in ticket_methods.py This is because the delete queue requires an admin token, ew * Fix deleting the backend message on ticket deletion * Always preserve support threads with >3 bot messages This is so that if someone runs ?faq, the ticket still counts as being resolved in the DB. * Debug-log message event data instead of printing * Use the reply_to_ticket util in macros --------- Co-authored-by: RandomSearch <101704343+RandomSearch18@users.noreply.github.com>
106 lines
No EOL
2.6 KiB
Text
106 lines
No EOL
2.6 KiB
Text
generator client {
|
|
provider = "prisma-client-py"
|
|
interface = "asyncio"
|
|
recursive_type_depth = 5
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum TicketStatus {
|
|
OPEN
|
|
IN_PROGRESS
|
|
CLOSED
|
|
}
|
|
|
|
model User {
|
|
id Int @id @unique @default(autoincrement())
|
|
slackId String @unique
|
|
username String? @unique
|
|
admin Boolean @default(false)
|
|
|
|
openedTickets Ticket[] @relation("OpenedTickets")
|
|
closedTickets Ticket[] @relation("ClosedTickets")
|
|
assignedTickets Ticket[] @relation("AssignedTickets")
|
|
|
|
tagSubscriptions UserTagSubscription[]
|
|
helper Boolean @default(false)
|
|
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Ticket {
|
|
id Int @id @unique @default(autoincrement())
|
|
title String
|
|
description String
|
|
status TicketStatus @default(OPEN)
|
|
|
|
// TS for the original help message (top of the help thread)
|
|
msgTs String @unique
|
|
// TS for the ticket message in the "backend" tickets channel
|
|
ticketTs String @unique
|
|
|
|
// Messages sent by the bot in the help thread
|
|
userFacingMsgs BotMessage[]
|
|
|
|
openedBy User @relation("OpenedTickets", fields: [openedById], references: [id])
|
|
openedById Int
|
|
|
|
closedBy User? @relation("ClosedTickets", fields: [closedById], references: [id])
|
|
closedById Int?
|
|
closedAt DateTime?
|
|
|
|
assignedTo User? @relation("AssignedTickets", fields: [assignedToId], references: [id])
|
|
assignedToId Int?
|
|
assignedAt DateTime?
|
|
|
|
tagsOnTickets TagsOnTickets[]
|
|
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model Tag {
|
|
id Int @id @unique @default(autoincrement())
|
|
name String @unique
|
|
|
|
ticketsOnTags TagsOnTickets[]
|
|
|
|
userSubscriptions UserTagSubscription[]
|
|
createdAt DateTime @default(now())
|
|
}
|
|
|
|
model TagsOnTickets {
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
ticketId Int
|
|
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
|
tagId Int
|
|
|
|
assignedAt DateTime @default(now())
|
|
|
|
@@id([ticketId, tagId])
|
|
@@map("tags_on_tickets")
|
|
}
|
|
|
|
model UserTagSubscription {
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId Int
|
|
tag Tag @relation(fields: [tagId], references: [id], onDelete: Cascade)
|
|
tagId Int
|
|
|
|
subscribedAt DateTime @default(now())
|
|
|
|
@@id([userId, tagId])
|
|
@@map("user_tag_subscriptions")
|
|
}
|
|
|
|
model BotMessage {
|
|
id Int @id @unique @default(autoincrement())
|
|
ts String
|
|
channelId String
|
|
ticket Ticket @relation(fields: [ticketId], references: [id], onDelete: Cascade)
|
|
ticketId Int
|
|
|
|
@@unique([ts, channelId])
|
|
} |