From a3140cd5944a1ac9ceebf684d7d074ab70c775e7 Mon Sep 17 00:00:00 2001 From: Maksym Shenderuk Date: Fri, 17 Nov 2023 14:27:23 +0000 Subject: [PATCH 1/6] Add project models ERD with descriptions --- Models.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Models.md diff --git a/Models.md b/Models.md new file mode 100644 index 0000000..3ea7eaa --- /dev/null +++ b/Models.md @@ -0,0 +1,32 @@ +# Entity-relationship diagram +```mermaid +erDiagram +USER }o--o{ USER : contact +CONFIG ||--|| USER : has +MESSAGE }o--|| USER : write +MESSAGE }o--o{ MESSAGE : "answer to" +GROUP }o--o{ USER : joined +``` + +# Models +`USER`: Represents individual users. +`CONFIG`: Represents configurations or settings. +`MESSAGE`: Represents individual messages sent or received. +`GROUP`: Represents a group of users. + +# 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 represent a social network-like relationship where users can communicate with each other. + +## USER with CONFIG +This notation signifies a one-to-one relationship, indicating that each user has one specific configuration, and that configuration is owned by that user exclusively. This relationship implies a direct mapping between a user and their unique configuration settings within the system. + +## 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-many relationship between messages, indicating that a message can be an answer to multiple other messages, and vice versa. This could represent threaded or nested messages where one message is a reply to another. + +## GROUP with USER +Represents a many-to-many relationship between GROUP and USER, indicating that users can join multiple groups, and a group can have multiple users as members. \ No newline at end of file From 2ff6e0c2e275d5cc59230cd62f074650b0e8ca0f Mon Sep 17 00:00:00 2001 From: Maksym Shenderuk Date: Fri, 17 Nov 2023 14:27:54 +0000 Subject: [PATCH 2/6] Mention models description --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f6cb1ca..b964d04 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # 🦾 Back-end part of the messenger application + +Detailed entities description can be found here [Models](Models.md) \ No newline at end of file From 84541b165b3dcfcec81257e79395c70ebfc3918e Mon Sep 17 00:00:00 2001 From: JaoodxD Date: Fri, 17 Nov 2023 16:42:05 +0200 Subject: [PATCH 3/6] Fix prettier --- Models.md | 9 ++++++++- README.md | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Models.md b/Models.md index 3ea7eaa..6f4eeaf 100644 --- a/Models.md +++ b/Models.md @@ -1,4 +1,5 @@ # Entity-relationship diagram + ```mermaid erDiagram USER }o--o{ USER : contact @@ -9,6 +10,7 @@ GROUP }o--o{ USER : joined ``` # Models + `USER`: Represents individual users. `CONFIG`: Represents configurations or settings. `MESSAGE`: Represents individual messages sent or received. @@ -17,16 +19,21 @@ GROUP }o--o{ USER : joined # 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 represent a social network-like relationship where users can communicate with each other. ## USER with CONFIG + This notation signifies a one-to-one relationship, indicating that each user has one specific configuration, and that configuration is owned by that user exclusively. This relationship implies a direct mapping between a user and their unique configuration settings within the system. ## 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-many relationship between messages, indicating that a message can be an answer to multiple other messages, and vice versa. This could represent threaded or nested messages where one message is a reply to another. ## GROUP with USER -Represents a many-to-many relationship between GROUP and USER, indicating that users can join multiple groups, and a group can have multiple users as members. \ No newline at end of file + +Represents a many-to-many relationship between GROUP and USER, indicating that users can join multiple groups, and a group can have multiple users as members. diff --git a/README.md b/README.md index b964d04..a0ea6f0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # 🦾 Back-end part of the messenger application -Detailed entities description can be found here [Models](Models.md) \ No newline at end of file +Detailed entities description can be found here [Models](Models.md) From 4a2f33d829bc90c9179285c12c59d7238cbb5097 Mon Sep 17 00:00:00 2001 From: Maksym Shenderuk Date: Fri, 24 Nov 2023 19:29:15 +0300 Subject: [PATCH 4/6] Extend models description with additional entities --- Models.md | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/Models.md b/Models.md index 6f4eeaf..0034719 100644 --- a/Models.md +++ b/Models.md @@ -3,28 +3,37 @@ ```mermaid erDiagram USER }o--o{ USER : contact -CONFIG ||--|| USER : has -MESSAGE }o--|| USER : write -MESSAGE }o--o{ MESSAGE : "answer to" -GROUP }o--o{ USER : joined +USER ||--|| SETTINGS : has +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. -`CONFIG`: Represents configurations or settings. +`GROUP`: Represents a group of users. +`SETTINGS`: Represents user or group settings. `MESSAGE`: Represents individual messages sent or received. -`GROUP`: Represents a group of users. +`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 represent a social network-like relationship where users can communicate with each other. +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 CONFIG +## USER with SETTINGS -This notation signifies a one-to-one relationship, indicating that each user has one specific configuration, and that configuration is owned by that user exclusively. This relationship implies a direct mapping between a user and their unique configuration settings within the system. +Represents a one-to-one relationship between USER and 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 SETTINGS + +Represents a one-to-one relationship between GROUP and SETTINGS, implying that each group has one specific set of settings associated with it. ## USER with MESSAGE @@ -32,8 +41,20 @@ Represents a one-to-many relationship between USER and MESSAGE, indicating that ## MESSAGE with MESSAGE -Represents a many-to-many relationship between messages, indicating that a message can be an answer to multiple other messages, and vice versa. This could represent threaded or nested messages where one message is a reply to another. +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. -## GROUP with USER +## MEDIA with GROUP -Represents a many-to-many relationship between GROUP and USER, indicating that users can join multiple groups, and a group can have multiple users as members. +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. From f276835b81ebd8636a78c5e2d3d4edab7f0f100b Mon Sep 17 00:00:00 2001 From: Maksym Shenderuk Date: Fri, 1 Dec 2023 17:36:14 +0200 Subject: [PATCH 5/6] Fix relations Fix relations discribed in https://github.com/dev-KPI/messenger-backend/pull/39#issuecomment-1825985855 --- Models.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Models.md b/Models.md index 0034719..b7381ab 100644 --- a/Models.md +++ b/Models.md @@ -3,13 +3,13 @@ ```mermaid erDiagram USER }o--o{ USER : contact -USER ||--|| SETTINGS : has -GROUP ||--|| SETTINGS : has +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" +MESSAGE }o--|| GROUP : "written in" MEDIA }o--|| MESSAGE : "attached to" ``` @@ -17,7 +17,8 @@ MEDIA }o--|| MESSAGE : "attached to" `USER`: Represents individual users. `GROUP`: Represents a group of users. -`SETTINGS`: Represents user or group settings. +`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. @@ -27,13 +28,13 @@ MEDIA }o--|| MESSAGE : "attached to" 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 SETTINGS +## USER with USER_SETTINGS -Represents a one-to-one relationship between USER and 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. +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 SETTINGS +## GROUP with GROUP_SETTINGS -Represents a one-to-one relationship between GROUP and SETTINGS, implying that each group has one specific set of settings associated with it. +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 From 06348abcf26a147964041924acc0bad85fccea4f Mon Sep 17 00:00:00 2001 From: JaoodxD Date: Fri, 1 Dec 2023 17:46:01 +0200 Subject: [PATCH 6/6] Fix prettier --- Models.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Models.md b/Models.md index b7381ab..c6ff4df 100644 --- a/Models.md +++ b/Models.md @@ -17,8 +17,8 @@ MEDIA }o--|| MESSAGE : "attached to" `USER`: Represents individual users. `GROUP`: Represents a group of users. -`USER_SETTINGS`: Represents user settings. -`GROUP_SETTINGS`: Represents group settings. +`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.