Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]: 33 designing models #39

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Entity-relationship diagram

```mermaid
erDiagram
USER }o--o{ USER : contact
USER ||--|| USER_SETTINGS : has
GROUP ||--|| GROUP_SETTINGS : has
USER ||--o{ MESSAGE : write
MESSAGE }o--o| MESSAGE : "answer to"
USER }o--o{ GROUP : "joined as role to"
USER }o--o{ GROUP : "grouped groups into folder"
MESSAGE }o--|| GROUP : "written in"
MEDIA }o--|| MESSAGE : "attached to"
```

# Models

`USER`: Represents individual users.
`GROUP`: Represents a group of users.
`USER_SETTINGS`: Represents user settings.
`GROUP_SETTINGS`: Represents group settings.
`MESSAGE`: Represents individual messages sent or received.
`MEDIA`: Represents various forms of media that can be attached to messages.

# Relations

## USER with USER

Represents a many-to-many relationship between users, indicating that users can be in contact with multiple other users and vice versa. This could signify connections or relationships between users.

## USER with USER_SETTINGS

Represents a one-to-one relationship between USER and USER_SETTINGS, indicating that each user has one specific set of settings associated with them. Each user's settings are unique and directly linked to that user.

## GROUP with GROUP_SETTINGS

Represents a one-to-one relationship between GROUP and GROUP_SETTINGS, implying that each group has one specific set of settings associated with it.

## USER with MESSAGE

Represents a one-to-many relationship between USER and MESSAGE, indicating that a user can write multiple messages, but each message is written by only one user.

## MESSAGE with MESSAGE

Represents a many-to-one relationship between messages, indicating that many messages can be responses or answers to a single specific message.

## USER with GROUP

Represents a many-to-many relationship between users and groups, where users can be associated with multiple groups, and a group can have multiple users in various roles.

## USER with GROUP

Represents a many-to-many relationship between users and groups, indicating that users can organize or group multiple groups into various folders, and a folder can contain multiple groups.

## MESSAGE with GROUP

Represents a one-to-many relationship between MESSAGE and GROUP, indicating that a message can be associated with one or more groups.

## MEDIA with GROUP

Represents a many-to-one relationship between MEDIA and MESSAGE, indicating that a message can have multiple types of media attached to it, but each media attachment belongs to only one message.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# 🦾 Back-end part of the messenger application

Detailed entities description can be found here [Models](Models.md)