Files
TREK/client/src/utils/reservationFiles.ts
T
Maurice 9529b55bd7 refactor(planner): share the booking files filter between desktop and phone
filesFor moves out of the desktop booking parts into utils, and the phone
transport sheet now reads a booking's files through it as the desktop
transport detail and booking cards do.
2026-10-09 07:16:40 +00:00

9 lines
380 B
TypeScript

import type { Reservation, TripFile } from '../types';
/** A booking's files: the ones uploaded to it and the ones linked to it, trashed files left out. */
export function filesFor(r: Pick<Reservation, 'id'>, files: TripFile[]): TripFile[] {
return files.filter(
(f) => !f.deleted_at && (f.reservation_id === r.id || (f.linked_reservation_ids || []).includes(r.id))
);
}