Skip to content

Commit

Permalink
channel creation
Browse files Browse the repository at this point in the history
  • Loading branch information
crushr3sist committed Apr 13, 2024
1 parent 4df544d commit cc1d15b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*__pycache__* .pytest_cache
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import Depends

from r3almX_backend.auth_service.auth_utils import get_current_user
from r3almX_backend.auth_service.user_handler_utils import get_db
from r3almX_backend.auth_service.user_models import User
Expand All @@ -21,6 +22,8 @@ async def create_channel(
new_room = ChannelsModel(
channel_name=channel_name,
channel_description=channel_description,
room_id=room.id,
author=user.id,
)

db.add(new_room)
Expand Down
Binary file not shown.
5 changes: 5 additions & 0 deletions r3almX_backend/chat_service/models/channels_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class ChannelsModel(Base):
"MessageModel", back_populates="channel", cascade="all, delete-orphan"
)

def __init__(self, channel_name, channel_description, author):
self.channel_name = channel_name
self.channel_description = channel_description
self.author = author


class MessageModel(Base):
__tablename__ = "messages"
Expand Down

0 comments on commit cc1d15b

Please sign in to comment.