Skip to content

Commit

Permalink
changed get_message_from_conversation to get_messages_from_conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
JamiCoder committed Dec 27, 2023
1 parent aeaa870 commit ebfd4ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime as dt
import sqlalchemy as sql
import passlib.hash as hash
import database as database # Your database configuration or import Base from SQLAlchemy
import database as database # Database Configuration
import uuid

class User(database.Base):
Expand All @@ -13,7 +13,7 @@ class User(database.Base):
last_name = sql.Column(sql.String)
hashed_password = sql.Column(sql.String)
date_created = sql.Column(sql.DateTime, default=dt.datetime.utcnow)
profile_picture = sql.Column(sql.String) # Adjust the type as needed
profile_picture = sql.Column(sql.String)

# Relationship with Conversation (one user can have multiple conversations)
conversations = sql.orm.relationship("Conversation", back_populates="user")
Expand Down Expand Up @@ -47,8 +47,6 @@ def generate_uuid(cls):
return generated_uid




class Message(database.Base):
__tablename__ = "messages"

Expand All @@ -66,5 +64,4 @@ class Message(database.Base):
conversation = sql.orm.relationship("Conversation", back_populates="messages")

def __repr__(self) -> str:
return f"Message: {self.text}"

return f"Message: {self.text}"
2 changes: 1 addition & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def get_user_conversation(


@app.get('/api/chat_history/{room_id}')
async def get_message_from_conversation(
async def get_messages_from_conversation(
room_id:str,
db: _orm.Session = _fastapi.Depends(_services.get_db),
token: str = _fastapi.Depends(_services.authenticate_token),
Expand Down

0 comments on commit ebfd4ff

Please sign in to comment.