mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 22:16:26 +00:00
9529b55bd7
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.
9 lines
380 B
TypeScript
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))
|
|
);
|
|
}
|