Skip to content

Commit

Permalink
Added get meetings with conversation status for userid
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-holzner committed Oct 1, 2024
1 parent affa731 commit fffccd5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions backend/app/routers/meetings.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,22 @@ def read_meetings(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)
meetings = get_meetings(db, skip=skip, limit=limit)
return meetings

@router.get("/meetings/{user_id}", response_model=List[schemas.MeetingStatusUser])
def read_meetings_by_user(user_id: int, db: Session = Depends(get_db)):
status_meetings = []
meetings = get_meetings(db)
for meeting in meetings:
conversation = get_conversation(db, meeting_id=meeting.id, user_id=user_id)
if conversation is None:
meeting_status = "todo"
else:
if conversation.finished:
meeting_status = "done"
else:
meeting_status = "in_progress"
status_meetings.append(schemas.MeetingStatusUser(conversation_status=meeting_status, meeting=meeting))
return status_meetings

@router.get("/meetings/{meeting_id}", response_model=schemas.MeetingSchema)
def read_meeting_route(meeting_id: int, db: Session = Depends(get_db)):
db_meeting = get_meeting(db, meeting_id=meeting_id)
Expand Down
11 changes: 11 additions & 0 deletions backend/app/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,16 @@ class Conversation(BaseModel):
system_prompt: str = "EMPTY"
finished: bool = False

class ConversationStatus(str, Enum):
TODO = "todo"
IN_PROGRESS = "in_progress"
DONE = "done"

class MeetingStatusUser(BaseModel):
conversation_status: ConversationStatus
meeting: Meeting





0 comments on commit fffccd5

Please sign in to comment.