πŸ“ž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 a File representing the group image.

  • group_chats (on File side): Should be declared in the File 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: Two User relationships with custom joins.

  • project: Linked to a Project.


πŸ’Œ ChatLog

Represents an individual message inside a chat (either group or personal).

🧩 Fields:

  • πŸ†” id: Primary key.

  • πŸ’¬ perschat_id: FK to PersonalChat (nullable).

  • πŸ’¬ groupchat_id: FK to GroupChat (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 to PersonalChat.

  • groupchat: Reference to GroupChat.

  • sender: Reference to User.


πŸ“Ž 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 the ChatLog message.

  • files: Link to the File model.

Last updated