-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from sinasezza/sinasezza
feat(chat): private and public rooms creation and join apis added to …
- Loading branch information
Showing
17 changed files
with
301 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
from datetime import datetime, timezone | ||
from datetime import datetime | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from chatApp.utils.object_id import PydanticObjectId | ||
|
||
|
||
class Room(BaseModel): | ||
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc)) | ||
members: list[PydanticObjectId] | ||
class PrivateRoom(BaseModel): | ||
member1: PydanticObjectId | ||
member2: PydanticObjectId | ||
created_at: datetime = Field(default_factory=lambda: datetime.now()) | ||
|
||
|
||
class RoomInDB(Room): | ||
class PrivateRoomInDB(PrivateRoom): | ||
id: PydanticObjectId = Field(alias="_id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from datetime import datetime | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from chatApp.utils.object_id import PydanticObjectId | ||
|
||
|
||
class PublicRoom(BaseModel): | ||
owner: PydanticObjectId | ||
name: str | ||
description: str | None = Field( | ||
default=None, description="Description of the room" | ||
) | ||
max_members: int | None = Field( | ||
default=None, description="Maximum number of members allowed" | ||
) | ||
welcome_message: str | None = Field( | ||
default=None, description="Welcome message for the room" | ||
) | ||
rules: str | None = Field(default=None, description="Rules for the room") | ||
allow_file_sharing: bool = Field( | ||
default=True, description="Allow file sharing in the room" | ||
) | ||
members: list[PydanticObjectId] = Field( | ||
default_factory=list, description="List of user IDs" | ||
) | ||
ban_list: list[PydanticObjectId] = Field( | ||
default_factory=list, description="List of IDs to be banned" | ||
) | ||
moderators: list[PydanticObjectId] = Field( | ||
default_factory=list, description="List of moderator IDs" | ||
) | ||
allow_users_access_message_history: bool = Field( | ||
True, description="Allow user to access message history" | ||
) | ||
max_latest_messages_access: int | None = Field( | ||
default=None, description="Maximum number of latest messages to access" | ||
) | ||
created_at: datetime = Field(default_factory=lambda: datetime.now()) | ||
|
||
|
||
class PublicRoomInDB(PublicRoom): | ||
id: PydanticObjectId = Field(alias="_id", serialization_alias="id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.