mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
f69a4c1a24
- A user can group the uses of one place (trip places and saved places) into a place identity of their own (user_places, user_place_links). It is personal: it groups their "All places" and is never written into a shared trip or list row. An identity without a use they can still reach is not shown, and one left without links is pruned on their next write and nightly. - Possible duplicates are suggested server side (same provider id, or the same name at the same spot), each pair with what differs and whether the user may merge it. A merge joins two identities in one transaction and can be undone; a dismissed pair does not come back. No trip or list row is deleted or changed. - A trip can link lists (trip_collection_links, needs place_edit and access to the list). A member sees a linked list only with their own access to it; the map layer lists its places and whether each is already in the trip. tripCollections:changed tells the members to read their view again. - REST, MCP tools and client data layer for all of it; migrations on both engines, additive only. - CI: the stage 1 to 2 places-library helper types, and the await-in-loop and non-null counts it had raised.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import type { TripCollectionLayerResponse, TripCollectionLinksResponse } from '@trek/shared';
|
|
|
|
import { tripCollectionsApi } from '../api/tripCollections';
|
|
import { requireOnline } from './onlineOnly';
|
|
|
|
/**
|
|
* The lists a trip draws on (PLC-15/PLC-16). Online only on purpose: who sees
|
|
* which linked list is the server's answer for each member, and the lists
|
|
* themselves are online only.
|
|
*/
|
|
export const tripCollectionsRepo = {
|
|
async list(tripId: number, signal?: AbortSignal): Promise<TripCollectionLinksResponse> {
|
|
requireOnline();
|
|
return await tripCollectionsApi.list(tripId, signal);
|
|
},
|
|
|
|
async layer(tripId: number, signal?: AbortSignal): Promise<TripCollectionLayerResponse> {
|
|
requireOnline();
|
|
return await tripCollectionsApi.layer(tripId, signal);
|
|
},
|
|
|
|
async link(tripId: number, collectionId: number): Promise<TripCollectionLinksResponse> {
|
|
requireOnline();
|
|
return await tripCollectionsApi.link(tripId, collectionId);
|
|
},
|
|
|
|
async unlink(tripId: number, collectionId: number): Promise<TripCollectionLinksResponse> {
|
|
requireOnline();
|
|
return await tripCollectionsApi.unlink(tripId, collectionId);
|
|
},
|
|
};
|