feat(places): tags on places, owned by the trip

A place keeps its one category, which decides its marker, and can now carry
any number of tags as extra labels to filter by.

- Tags belong to the trip (tags.trip_id): every member sees the same list and
  whoever may edit the trip's places adds, renames and deletes. Personal tags
  stay what they were.
- The place form picks them on desktop and mobile through one shared hook,
  usePlaceTags, and can add a new tag to the trip on the spot.
- The existing category filter of the places list lists the tags as well.
- Tags show on the place (inspector pills, phone place sheet); the marker is
  untouched.
- MCP: create_place, create_and_assign_place and update_place take `tags`,
  and list/create/update/delete_trip_tag manage a trip's tags.
- /api/trips/:tripId/tags and the tripTags:changed event keep every client
  of the trip in step.
This commit is contained in:
Mariano
2026-11-17 06:35:09 +00:00
committed by Maurice
parent e952586f60
commit 33d074c786
108 changed files with 3634 additions and 118 deletions
@@ -21,6 +21,7 @@ import {
buildTodoItem,
buildBudgetItem,
buildReservation,
buildTag,
buildTripFile,
} from '../../helpers/factories';
@@ -293,6 +294,27 @@ describe('tripSyncManager.syncAll — bundle upsert', () => {
expect(meta!.lastSyncedAt).toBeGreaterThanOrEqual(before);
expect(meta!.lastSyncedAt).toBeLessThanOrEqual(after);
});
it("keeps the trip's own tags for offline, and a trip whose tags cannot be read still syncs", async () => {
const tag = buildTag({ id: 7, trip_id: 302, name: 'Monument' });
server.use(
http.get('/api/trips', () =>
HttpResponse.json({
trips: [buildTrip({ id: 302, end_date: dateOffset(5) }), buildTrip({ id: 303, end_date: dateOffset(5) })],
}),
),
http.get('/api/trips/302/bundle', () => HttpResponse.json(makeBundle(302))),
http.get('/api/trips/303/bundle', () => HttpResponse.json(makeBundle(303))),
http.get('/api/trips/302/tags', () => HttpResponse.json({ tags: [tag] })),
http.get('/api/trips/303/tags', () => HttpResponse.json({ error: 'Trip not found' }, { status: 404 })),
);
expect(await tripSyncManager.syncAll()).toEqual({ status: 'done', trips: 2 });
expect((await offlineDb.tripTags.get(302))?.tags).toEqual([tag]);
expect(await offlineDb.tripTags.get(303)).toBeUndefined();
expect(await offlineDb.syncMeta.get(303)).toBeDefined();
});
});
describe('tripSyncManager.syncAll — tours', () => {