feat: implement support chat functionality with new module, service, controller, DTOs, and schema updates.
This commit is contained in:
@@ -75,6 +75,11 @@ enum MessageStatus {
|
||||
READ
|
||||
}
|
||||
|
||||
enum SupportChatStatus {
|
||||
OPEN
|
||||
CLOSED
|
||||
}
|
||||
|
||||
|
||||
// ===========================================
|
||||
// USER - Authentication Only
|
||||
@@ -135,6 +140,9 @@ model User {
|
||||
// Notifications
|
||||
notifications Notification[]
|
||||
|
||||
// Support Chat
|
||||
supportChats SupportChat[]
|
||||
|
||||
@@index([email])
|
||||
@@index([role])
|
||||
@@index([status])
|
||||
@@ -572,3 +580,40 @@ model Testimonial {
|
||||
@@index([agentProfileId])
|
||||
@@map("testimonials")
|
||||
}
|
||||
|
||||
// ===========================================
|
||||
// SUPPORT CHAT SYSTEM
|
||||
// ===========================================
|
||||
|
||||
model SupportChat {
|
||||
id String @id @default(uuid())
|
||||
userId String
|
||||
status SupportChatStatus @default(OPEN)
|
||||
lastMessageAt DateTime?
|
||||
lastMessageText String? @db.VarChar(255)
|
||||
userUnreadCount Int @default(0)
|
||||
adminUnreadCount Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
messages SupportMessage[]
|
||||
|
||||
@@index([userId])
|
||||
@@index([status])
|
||||
@@map("support_chats")
|
||||
}
|
||||
|
||||
model SupportMessage {
|
||||
id String @id @default(uuid())
|
||||
chatId String
|
||||
senderId String
|
||||
senderRole String // "USER" or "ADMIN"
|
||||
content String @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
chat SupportChat @relation(fields: [chatId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([chatId])
|
||||
@@map("support_messages")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user