Skip to content

Commit

Permalink
Merge pull request #14 from zucchero-sintattico/feature/ddd
Browse files Browse the repository at this point in the history
Feature/ddd
  • Loading branch information
manuandru authored Feb 24, 2024
2 parents f440b76 + 9537bf3 commit 6238575
Show file tree
Hide file tree
Showing 12 changed files with 171 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
.idea/kotlinc.xml
.idea/.gitignore
.idea/vcs.xml
.idea/ktfmt.xml

# CMake
cmake-build-*/
Expand Down
86 changes: 86 additions & 0 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
@@ -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 |
3 changes: 3 additions & 0 deletions commons/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("kotlin-base")
}
5 changes: 5 additions & 0 deletions commons/src/main/kotlin/piperchat/commons/UserId.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package piperchat.commons

interface UserId {
val value: String
}
3 changes: 0 additions & 3 deletions domain/build.gradle.kts

This file was deleted.

5 changes: 0 additions & 5 deletions domain/src/main/kotlin/piperchat/Main.kt

This file was deleted.

7 changes: 7 additions & 0 deletions servers-service/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id("kotlin-base")
}

dependencies {
implementation(project(":commons"))
}
16 changes: 16 additions & 0 deletions servers-service/src/main/kotlin/piperchat/servers/Channel.kt
Original file line number Diff line number Diff line change
@@ -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<UserId>
val createdAt: Date
}
18 changes: 18 additions & 0 deletions servers-service/src/main/kotlin/piperchat/servers/Server.kt
Original file line number Diff line number Diff line change
@@ -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<UserId>
val createdAt: Date
val channels: List<Channel>
}
4 changes: 3 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ gitHooks {
createHooks(overwriteExisting = true) // actual hooks creation
}

include("domain")
include("users-service")
include("servers-service")
include("commons")
7 changes: 7 additions & 0 deletions users-service/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id("kotlin-base")
}

dependencies {
implementation(project(":commons"))
}
25 changes: 25 additions & 0 deletions users-service/src/main/kotlin/piperchat/users/domain/User.kt
Original file line number Diff line number Diff line change
@@ -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<UserId>
}

interface FriendRequest {
val id: String
val from: User
val to: User
val status: FriendRequestStatus
}

enum class FriendRequestStatus {
PENDING,
ACCEPTED,
REJECTED
}

0 comments on commit 6238575

Please sign in to comment.