mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-06 18:56:48 +00:00
fix: convert DB models to view models in bulk-status endpoint
model_validate(from_attributes=True) needed to convert DB Meeting and CalendarEvent to their view-layer Pydantic counterparts.
This commit is contained in:
@@ -239,7 +239,9 @@ async def rooms_bulk_meeting_status(
|
|||||||
m.platform = room.platform
|
m.platform = room.platform
|
||||||
if user_id != room.user_id and m.platform == "whereby":
|
if user_id != room.user_id and m.platform == "whereby":
|
||||||
m.host_room_url = ""
|
m.host_room_url = ""
|
||||||
active_by_room[room.name].append(m)
|
active_by_room[room.name].append(
|
||||||
|
Meeting.model_validate(m, from_attributes=True)
|
||||||
|
)
|
||||||
|
|
||||||
upcoming_by_room: dict[str, list[CalendarEventResponse]] = defaultdict(list)
|
upcoming_by_room: dict[str, list[CalendarEventResponse]] = defaultdict(list)
|
||||||
for e in upcoming_events:
|
for e in upcoming_events:
|
||||||
@@ -249,7 +251,9 @@ async def rooms_bulk_meeting_status(
|
|||||||
if user_id != room.user_id:
|
if user_id != room.user_id:
|
||||||
e.description = None
|
e.description = None
|
||||||
e.attendees = None
|
e.attendees = None
|
||||||
upcoming_by_room[room.name].append(e)
|
upcoming_by_room[room.name].append(
|
||||||
|
CalendarEventResponse.model_validate(e, from_attributes=True)
|
||||||
|
)
|
||||||
|
|
||||||
result: dict[str, RoomMeetingStatus] = {}
|
result: dict[str, RoomMeetingStatus] = {}
|
||||||
for name in request.room_names:
|
for name in request.room_names:
|
||||||
|
|||||||
Reference in New Issue
Block a user