mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-07 03:06:46 +00:00
fix: address review feedback
- Add PUBLIC_MODE auth guard on bulk-status endpoint - Convert DB models to view models via model_validate() - Early return when no accessible rooms (skip DB queries) - BulkMeetingStatusMap: Partial<Record> for type honesty - Sort roomNames in query key for cache stability - Remove redundant empty-guard in queryFn - Add 7 backend tests: auth, redaction, whereby host_room_url, 401, empty - Add 2 frontend tests: error handling, unauthenticated case
This commit is contained in:
@@ -782,15 +782,15 @@ export function useRoomActiveMeetings(roomName: string | null) {
|
||||
|
||||
type RoomMeetingStatus = components["schemas"]["RoomMeetingStatus"];
|
||||
|
||||
export type BulkMeetingStatusMap = Record<string, RoomMeetingStatus>;
|
||||
export type BulkMeetingStatusMap = Partial<Record<string, RoomMeetingStatus>>;
|
||||
|
||||
export function useRoomsBulkMeetingStatus(roomNames: string[]) {
|
||||
const { isAuthenticated } = useAuthReady();
|
||||
const sortedNames = [...roomNames].sort();
|
||||
|
||||
return useQuery({
|
||||
queryKey: ["bulk-meeting-status", roomNames],
|
||||
queryKey: ["bulk-meeting-status", sortedNames],
|
||||
queryFn: async (): Promise<BulkMeetingStatusMap> => {
|
||||
if (roomNames.length === 0) return {};
|
||||
const { data, error } = await client.POST(
|
||||
"/v1/rooms/meetings/bulk-status",
|
||||
{ body: { room_names: roomNames } },
|
||||
@@ -802,7 +802,7 @@ export function useRoomsBulkMeetingStatus(roomNames: string[]) {
|
||||
}
|
||||
return data;
|
||||
},
|
||||
enabled: roomNames.length > 0 && isAuthenticated,
|
||||
enabled: sortedNames.length > 0 && isAuthenticated,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user