From d398107d0df5f1a26ebf4413a55638c382795f4e Mon Sep 17 00:00:00 2001 From: Manuel Andruccioli Date: Sun, 11 Feb 2024 16:04:49 +0100 Subject: [PATCH 1/5] feat(ddd): init with glossary --- GLOSSARY.md | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 GLOSSARY.md diff --git a/GLOSSARY.md b/GLOSSARY.md new file mode 100644 index 00000000..765c0333 --- /dev/null +++ b/GLOSSARY.md @@ -0,0 +1,86 @@ + +# Glossary + +Domain glossary for discord clone + +## Concepts + +| Term | Definition | +|--------------------|-----------------------------------------------------------| +| System | The application that is | +| User | A person who uses the system and it's registered | +| User Profile | Information about a user | +| Message | A piece of text sent by a user | +| Session | A video chat session between allowed users | +| Friend | A user who is added to another user's friend list | +| Friendship | A pair of users who have added each other as friends | +| Friend Request | A request to add a user as a friend, sent by another user | +| Direct | A chat between two users that are friends | +| Direct Message | A message sent in a direct | +| Direct Session | A session dedicated to a friendship | +| Server | A group of channels and members | +| Server Profile | Information about a server | +| Owner | The user who created a server | +| Member | A user who is joined in a server | +| Channel | A room inside a server | +| Message Channel | A channel used for text chat | +| Channel Message | A message sent in a message channel | +| Multimedia Channel | A channel used for video chat | +| Multimedia Session | A session dedicated to a multimedia channel | + +## Actions + +### Users + +| Term | Definition | +|-----------------------|------------------------------------------------------------------------------------| +| Registering | The action performed by a person to create an account and becoming a user | +| Logging in | The action performed by a user to enter the system and authenticate himself | +| Logging out | The action performed by a user to exit the system | +| Updating user profile | The action performed by a user to change their profile information and preferences | + +### Friendships + +| Term | Definition | +|----------------------------|-----------------------------------------------------------------------------| +| Sending a friend request | The action performed by a user to send a friend request to another user | +| Accepting a friend request | The action performed by a user to accept a friend request from another user | +| Rejecting a friend request | The action performed by a user to reject a friend request from another user | + +### Directs + +| Term | Definition | +|--------------------------|------------------------------------------------------------------| +| Sending a direct message | The action performed by a user to send a message to another user | +| Joining a direct session | The action performed by a user to enter a direct session | + + +### Servers + +| Term | Definition | +|-----------------------|-----------------------------------------------------------------| +| Creating a server | The action performed by a user to create a server | +| Joining a server | The action performed by a user to enter a server | +| Leaving a server | The action performed by a user to exit a server | +| Deleting a server | The action performed by a user to delete a server | +| Kicking a member | The action performed by a user to remove a member from a server | +| Update server profile | The action performed by a user to update server settings | + +### Channels + +| Term | Definition | +|------------------------------|--------------------------------------------------------------| +| Creating a channel | The action performed by a user to create a channel | +| Deleting a channel | The action performed by a user to delete a channel | +| Joining a multimedia session | The action performed by a user to enter a multimedia session | +| Changing channel settings | The action performed by a user to change channel settings | + +### Sessions + +| Term | Definition | +|----------------------------|---------------------------------------------------------------------| +| Leaving a session | The action performed by a user to exit a session | +| Turning on the camera | The action performed by a user to start the camera in a session | +| Turning off the camera | The action performed by a user to stop the camera in a session | +| Turning on the microphone | The action performed by a user to start the microphone in a session | +| Turning off the microphone | The action performed by a user to stop the microphone in a session | From 97c3dda8e38b99518c46fb5accc2ad85cb7009ce Mon Sep 17 00:00:00 2001 From: Manuel Andruccioli Date: Sun, 11 Feb 2024 18:56:36 +0100 Subject: [PATCH 2/5] feat(repo): add common concept package --- commons/build.gradle.kts | 3 +++ commons/src/main/kotlin/piperchat/commons/UserId.kt | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 commons/build.gradle.kts create mode 100644 commons/src/main/kotlin/piperchat/commons/UserId.kt diff --git a/commons/build.gradle.kts b/commons/build.gradle.kts new file mode 100644 index 00000000..0530d6e6 --- /dev/null +++ b/commons/build.gradle.kts @@ -0,0 +1,3 @@ +plugins { + id("kotlin-base") +} diff --git a/commons/src/main/kotlin/piperchat/commons/UserId.kt b/commons/src/main/kotlin/piperchat/commons/UserId.kt new file mode 100644 index 00000000..df17f91b --- /dev/null +++ b/commons/src/main/kotlin/piperchat/commons/UserId.kt @@ -0,0 +1,5 @@ +package piperchat.commons + +interface UserId { + val value: String +} From 888983a03de26d75bb7280a6b841f74a8b9c4213 Mon Sep 17 00:00:00 2001 From: Manuel Andruccioli Date: Sun, 11 Feb 2024 18:59:18 +0100 Subject: [PATCH 3/5] feat(ddd): add users concept in domain --- domain/build.gradle.kts | 3 --- domain/src/main/kotlin/piperchat/Main.kt | 5 ---- users-service/build.gradle.kts | 7 ++++++ .../kotlin/piperchat/users/domain/User.kt | 25 +++++++++++++++++++ 4 files changed, 32 insertions(+), 8 deletions(-) delete mode 100644 domain/build.gradle.kts delete mode 100644 domain/src/main/kotlin/piperchat/Main.kt create mode 100644 users-service/build.gradle.kts create mode 100644 users-service/src/main/kotlin/piperchat/users/domain/User.kt diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts deleted file mode 100644 index 766e06db..00000000 --- a/domain/build.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -plugins { - id("kotlin-base") -} diff --git a/domain/src/main/kotlin/piperchat/Main.kt b/domain/src/main/kotlin/piperchat/Main.kt deleted file mode 100644 index 2ea6eb66..00000000 --- a/domain/src/main/kotlin/piperchat/Main.kt +++ /dev/null @@ -1,5 +0,0 @@ -package piperchat - -fun main() { - println("Hello World!") -} diff --git a/users-service/build.gradle.kts b/users-service/build.gradle.kts new file mode 100644 index 00000000..6a2df06f --- /dev/null +++ b/users-service/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + id("kotlin-base") +} + +dependencies { + implementation(project(":commons")) +} \ No newline at end of file diff --git a/users-service/src/main/kotlin/piperchat/users/domain/User.kt b/users-service/src/main/kotlin/piperchat/users/domain/User.kt new file mode 100644 index 00000000..92df1ac2 --- /dev/null +++ b/users-service/src/main/kotlin/piperchat/users/domain/User.kt @@ -0,0 +1,25 @@ +package piperchat.users.domain + +import piperchat.commons.UserId + +interface User { + val id: UserId + val username: String + val email: String + val description: String? + val photoUrl: String? + val friends: List +} + +interface FriendRequest { + val id: String + val from: User + val to: User + val status: FriendRequestStatus +} + +enum class FriendRequestStatus { + PENDING, + ACCEPTED, + REJECTED +} From b41b0461339970a08cf0dec4f127e27fd7317757 Mon Sep 17 00:00:00 2001 From: Manuel Andruccioli Date: Sun, 11 Feb 2024 18:59:53 +0100 Subject: [PATCH 4/5] feat(ddd): add servers and channel concept in domain --- servers-service/build.gradle.kts | 7 +++++++ .../main/kotlin/piperchat/servers/Channel.kt | 16 ++++++++++++++++ .../main/kotlin/piperchat/servers/Server.kt | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 servers-service/build.gradle.kts create mode 100644 servers-service/src/main/kotlin/piperchat/servers/Channel.kt create mode 100644 servers-service/src/main/kotlin/piperchat/servers/Server.kt diff --git a/servers-service/build.gradle.kts b/servers-service/build.gradle.kts new file mode 100644 index 00000000..93d7ded6 --- /dev/null +++ b/servers-service/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + id("kotlin-base") +} + +dependencies { + implementation(project(":commons")) +} \ No newline at end of file diff --git a/servers-service/src/main/kotlin/piperchat/servers/Channel.kt b/servers-service/src/main/kotlin/piperchat/servers/Channel.kt new file mode 100644 index 00000000..d2f03800 --- /dev/null +++ b/servers-service/src/main/kotlin/piperchat/servers/Channel.kt @@ -0,0 +1,16 @@ +package piperchat.servers + +import java.util.Date +import piperchat.commons.UserId + +interface ChannelId { + val value: String +} + +interface Channel { + val id: ChannelId + val name: String + val description: String + val participants: List + val createdAt: Date +} diff --git a/servers-service/src/main/kotlin/piperchat/servers/Server.kt b/servers-service/src/main/kotlin/piperchat/servers/Server.kt new file mode 100644 index 00000000..30ac48c0 --- /dev/null +++ b/servers-service/src/main/kotlin/piperchat/servers/Server.kt @@ -0,0 +1,18 @@ +package piperchat.servers + +import java.util.Date +import piperchat.commons.UserId + +interface ServerId { + val value: String +} + +interface Server { + val id: ServerId + val name: String + val description: String + val owner: UserId + val participants: List + val createdAt: Date + val channels: List +} From 9537bf36b6452599f3928779d440808753348c6b Mon Sep 17 00:00:00 2001 From: Manuel Andruccioli Date: Sun, 11 Feb 2024 19:00:30 +0100 Subject: [PATCH 5/5] chore(repo): include projects and add ktfmt to gitignore --- .gitignore | 1 + settings.gradle.kts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 87674169..302a2c4e 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ .idea/kotlinc.xml .idea/.gitignore .idea/vcs.xml +.idea/ktfmt.xml # CMake cmake-build-*/ diff --git a/settings.gradle.kts b/settings.gradle.kts index f1a9ca87..adf27f02 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -31,4 +31,6 @@ gitHooks { createHooks(overwriteExisting = true) // actual hooks creation } -include("domain") +include("users-service") +include("servers-service") +include("commons")