mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
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:
@@ -19,6 +19,7 @@ const FIXTURES: Record<TrekWsEventName, Record<string, unknown>> = {
|
||||
'place:created': { place: { id: 3, name: 'Louvre' } },
|
||||
'place:updated': { place: { id: 3, name: 'Louvre' } },
|
||||
'place:deleted': { placeId: 3 },
|
||||
'tripTags:changed': {},
|
||||
'tours:changed': { placeIds: [3] },
|
||||
'tours:visits': { assignmentId: 9, visits: [{ assignment_id: 9, station_key: 'abcdef', status: 'visited' }] },
|
||||
'assignment:created': { assignment: { id: 9, day_id: 2 } },
|
||||
@@ -219,9 +220,11 @@ describe('@trek/shared realtime event registry', () => {
|
||||
// writes that send them follow.
|
||||
// 42nd and 43rd user event: mailInbox:changed and mailInbox:settings, the
|
||||
// inbox of forwarded booking mails and its settings card.
|
||||
expect(TREK_WS_TRIP_EVENT_NAMES).toHaveLength(80);
|
||||
// 81st trip event: tripTags:changed, so a tag a member adds to the trip,
|
||||
// renames or deletes shows the same for everyone on it.
|
||||
expect(TREK_WS_TRIP_EVENT_NAMES).toHaveLength(81);
|
||||
expect(TREK_WS_USER_EVENT_NAMES).toHaveLength(43);
|
||||
expect(TREK_WS_EVENT_NAMES).toHaveLength(123);
|
||||
expect(TREK_WS_EVENT_NAMES).toHaveLength(124);
|
||||
});
|
||||
|
||||
it('WSEVT-REG-002: every name is domain:action shaped and outside the reserved plugin: namespace', () => {
|
||||
|
||||
@@ -65,6 +65,9 @@ export const TREK_WS_EVENTS = {
|
||||
'place:created': { scope: 'trip', payload: z.object({ place: entity }) },
|
||||
'place:updated': { scope: 'trip', payload: z.object({ place: entity }) },
|
||||
'place:deleted': { scope: 'trip', payload: z.object({ placeId: id }) },
|
||||
// The trip's own tags changed (one added, renamed, recoloured or deleted): every
|
||||
// client reads the list again and takes the change over into the places it holds.
|
||||
'tripTags:changed': { scope: 'trip', payload: empty },
|
||||
// Invalidate the trip's Tours list; affected ids let peers exclude new Tours immediately.
|
||||
'tours:changed': { scope: 'trip', payload: z.object({ placeIds: idList.optional() }) },
|
||||
// CW-03: the stations of a city walk visited or skipped on one of its days, all of them as they are now.
|
||||
|
||||
Reference in New Issue
Block a user