mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 17:38:12 +00:00
feat: setup the attachment to the passenger api
This commit is contained in:
@@ -916,10 +916,37 @@ model SupportMessage {
|
||||
id String @id @default(uuid())
|
||||
conversationId String
|
||||
sender SupportSender
|
||||
text String
|
||||
attachments Json?
|
||||
/// NULL for an attachment-only message — absence of text is representable
|
||||
/// rather than smuggled through "". The DTO maps NULL -> "".
|
||||
text String?
|
||||
createdAt DateTime @default(now())
|
||||
conversation SupportConversation @relation(fields: [conversationId], references: [id])
|
||||
attachments SupportAttachment[]
|
||||
/// Backs keyset pagination of a thread (newest-first over (createdAt, id)).
|
||||
/// Without it, paging a long thread degrades to a scan per page.
|
||||
@@index([conversationId, createdAt])
|
||||
@@schema("passenger")
|
||||
}
|
||||
|
||||
/// A file posted on a support message.
|
||||
///
|
||||
/// The freight side stores the equivalent in its polymorphic `freight.files`
|
||||
/// table; this app has no such table (and no TypeORM), so chat attachments get a
|
||||
/// purpose-built model rather than a shared one. Bytes live in MinIO — `url` is
|
||||
/// the unsigned object path, signed on read for preview.
|
||||
model SupportAttachment {
|
||||
id String @id @default(uuid())
|
||||
messageId String
|
||||
name String
|
||||
mimeType String
|
||||
/// Bytes.
|
||||
size Int
|
||||
/// Unsigned MinIO object URL. Not directly fetchable by a browser — the API
|
||||
/// mints a short-lived signed URL per response.
|
||||
url String
|
||||
createdAt DateTime @default(now())
|
||||
message SupportMessage @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
@@index([messageId])
|
||||
@@schema("passenger")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user