Untitled
Anonymous
Plain Text
09/30/2025 9:10 AM
6.0 KB
18
Indexable
Never
model UserThirdParty {
id String @id @default(dbgenerated("uuid_generate_v4()")) @map("id") @db.Uuid
hostawayUserId Int @unique @map("hostaway_user_id") @db.Integer
listingPlatformConfigId String @map("listing_platform_config_id") @db.Uuid
listingPlatformConfig ListingPlatformConfig @relation(fields: [listingPlatformConfigId], references: [id])
email String? @map("email") @db.VarChar
firstName String? @map("first_name") @db.VarChar
lastName String? @map("last_name") @db.VarChar
rolesJson Json? @map("roles_json") @db.Json
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
updatedAt DateTime @updatedAt @map("updated_at")
sentMessages MessageThirdParty[]
@@map("user_third_party")
}
model GuestThirdParty {
id String @id @default(dbgenerated("uuid_generate_v4()")) @map("id") @db.Uuid
listingPlatformConfigId String @map("listing_platform_config_id") @db.Uuid
listingPlatformConfig ListingPlatformConfig @relation(fields: [listingPlatformConfigId], references: [id])
reservationId Int @unique @map("reservation_id") @db.Integer
displayName String? @map("display_name") @db.VarChar
email String? @map("email") @db.VarChar
phone String? @map("phone") @db.VarChar
pictureUrl String? @map("picture_url") @db.VarChar
country String? @map("country") @db.VarChar
city String? @map("city") @db.VarChar
channelId Int? @map("channel_id") @db.Integer
channelGuestId String? @map("channel_guest_id") @db.VarChar
// đồng bộ
lastSyncedAt DateTime? @map("last_synced_at") @db.Timestamp(6)
sourceUpdatedAt DateTime? @map("source_updated_at") @db.Timestamp(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
updatedAt DateTime @updatedAt @map("updated_at")
conversations ConversationThirdParty[]
@@map("guest_third_party")
}
model ConversationThirdParty {
id String @id @default(dbgenerated("uuid_generate_v4()")) @map("id") @db.Uuid
hostawayConversationId Int @unique @map("hostaway_conversation_id") @db.Integer
listingPlatformConfigId String @map("listing_platform_config_id") @db.Uuid
listingPlatformConfig ListingPlatformConfig @relation(fields: [listingPlatformConfigId], references: [id])
reservationId Int @map("reservation_id") @db.Integer
guestId String? @map("guest_id") @db.Uuid
guest GuestThirdParty? @relation(fields: [guestId], references: [id])
listingMapId Int? @map("listing_map_id") @db.Integer
channelId Int? @map("channel_id") @db.Integer
assigneeHostawayUserId Int? @map("assignee_hostaway_user_id") @db.Integer
/// @FieldType({ name: 'ConversationStatus', from: '@core/enums', output: true, input: true })
status Int @default(0) @map("status")
hasUnread Boolean @default(false) @map("has_unread")
messageCount Int @default(0) @map("message_count")
unreadCount Int @default(0) @map("unread_count")
firstMessageAt DateTime? @map("first_message_at") @db.Timestamp(6)
lastMessageAt DateTime? @map("last_message_at") @db.Timestamp(6)
lastGuestMessageAt DateTime? @map("last_guest_message_at") @db.Timestamp(6)
lastAgentReplyAt DateTime? @map("last_agent_reply_at") @db.Timestamp(6)
// snapshot hiển thị nhanh
snapshotGuestName String? @map("snapshot_guest_name") @db.VarChar
snapshotGuestEmail String? @map("snapshot_guest_email") @db.VarChar
snapshotGuestPicture String? @map("snapshot_guest_picture") @db.VarChar
snapshotUpdatedAt DateTime? @map("snapshot_updated_at") @db.Timestamp(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
updatedAt DateTime @updatedAt @map("updated_at")
messages MessageThirdParty[]
@@map("conversation_third_party")
}
model MessageThirdParty {
id String @id @default(dbgenerated("uuid_generate_v4()")) @map("id") @db.Uuid
hostawayMessageId Int @unique @map("hostaway_message_id") @db.Integer
listingPlatformConfigId String @map("listing_platform_config_id") @db.Uuid
listingPlatformConfig ListingPlatformConfig @relation(fields: [listingPlatformConfigId], references: [id])
conversationId String @map("conversation_id") @db.Uuid
conversation ConversationThirdParty @relation(fields: [conversationId], references: [id])
isIncoming Boolean @map("is_incoming")
senderHostawayUserId Int? @map("sender_hostaway_user_id") @db.Integer
senderUser UserThirdParty? @relation(fields: [senderHostawayUserId], references: [hostawayUserId])
body String @map("body") @db.Text
/// @FieldType({ name: 'MessageStatus', from: '@core/enums', output: true, input: true })
status Int? @map("status")
/// @FieldType({ name: 'CommunicationType', from: '@core/enums', output: true, input: true })
communicationType Int? @map("communication_type")
communicationEvent String? @map("communication_event") @db.VarChar
isSeen Boolean @default(false) @map("is_seen")
sentUsingHostaway Boolean @default(false) @map("sent_using_hostaway")
channelThreadMessageId String? @unique @map("channel_thread_message_id") @db.VarChar
hash String? @unique @map("hash") @db.VarChar
date DateTime? @map("date") @db.Timestamp(6)
sentChannelDate DateTime? @map("sent_channel_date") @db.Timestamp(6)
insertedOn DateTime? @map("inserted_on") @db.Timestamp(6)
updatedOn DateTime? @map("updated_on") @db.Timestamp(6)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(6)
updatedAt DateTime @updatedAt @map("updated_at")
@@map("message_third_party")
}
Editor is loading...
Leave a Comment