πchats
These models support group chats, personal chats, messages, and file attachments in a project collaboration environment.
π§βπ€βπ§ GroupChat
Represents a group conversation, optionally with a display image.
π§© Fields:
π
id
: Primary key.πΌοΈ
image_id
: Optional foreign key to an image file.π¬
chat_name
: Group chat name (required).π
creation_date
: Timestamp when the chat was created (required).π
description
: Optional description of the chat.
π Relationships:
image
: Connects to aFile
representing the group image.group_chats
(onFile
side): Should be declared in theFile
model (back_populates='image'
).
π₯ PersonalChat
Handles 1-on-1 direct messages between two users, optionally linked to a project.
π§© Fields:
π
id
: Primary key.π€
user1_id
: First user in the chat (required).π€
user2_id
: Second user in the chat (required).π
project_id
: Optional link to a related project.
π Relationships:
user1
/user2
: TwoUser
relationships with custom joins.project
: Linked to aProject
.
π ChatLog
Represents an individual message inside a chat (either group or personal).
π§© Fields:
π
id
: Primary key.π¬
perschat_id
: FK toPersonalChat
(nullable).π¬
groupchat_id
: FK toGroupChat
(nullable).βοΈ
sender_id
: User who sent the message (required).π
date_sent
: Timestamp of the message (required).π¬
state
: Message status enum type ("sent" , "delivered" , "read") (required).π
message_cont
: Optional message text.
π Relationships:
perschat
: Reference toPersonalChat
.groupchat
: Reference toGroupChat
.sender
: Reference toUser
.
π ChatLogsFile
Links a file attachment to a chat message.
π§© Fields:
π
id
: Primary key.π
chat_logs_id
: The chat message this file belongs to (required).π
files_id
: The actual file uploaded (required).
π Relationships:
chat_logs
: Link to theChatLog
message.files
: Link to theFile
model.
Last updated