Skip to content

Commit

Permalink
add new schema and update chat api response
Browse files Browse the repository at this point in the history
  • Loading branch information
Lopkop committed Mar 4, 2024
1 parent 81d5a56 commit f8bca1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions backend/db/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ class UserUndefinedModel(BaseModel):
class Token(BaseModel):
access_token: str
token_type: str


class ChatRequest(BaseModel):
chatname: str
username: str
3 changes: 1 addition & 2 deletions backend/sockets/response_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def generate_get_messages_response(status: bool, chatroom: ChatRoomModel) -> Get

@staticmethod
def generate_chat_response(status: int, chatroom: ChatRoomModel):
response_model = ChatResponseModel(**chatroom.dict(), status=status)
return response_model
return {"status": status, "chatroom": chatroom}

@staticmethod
def generate_user_undefined_error_response(username: str) -> UserUndefinedModel:
Expand Down

0 comments on commit f8bca1f

Please sign in to comment.