feat(collections): edit a saved place's provider ids, website, phone and price (#2646)

The update contract takes google_place_id, google_ftid, osm_id, website,
phone, price and currency like saving does, website with the same
normalisation and refusal. REST and update_collection_place share it, so an
agent can correct a place instead of re-saving it and losing its labels,
ratings, position and id. The assistant's change card names the new fields.
This commit is contained in:
Maurice
2026-11-13 09:33:27 +01:00
parent 72e8b1f8d9
commit cae04e83dd
44 changed files with 289 additions and 13 deletions
@@ -32,6 +32,11 @@ export const COLLECTION_CARD_FIELDS = [
'category',
'link',
'photo',
'website',
'phone',
'price',
/** The place's Google or OpenStreetMap entry (its provider ids). */
'mapEntry',
] as const;
/** What a change does to a label of a list; `none` on an answer. */
@@ -75,7 +80,7 @@ export const collectionCardDeltaSchema = z.object({
rating: z.object({ to: z.number().int().min(1).max(5).nullable() }).nullable(),
labelsAdded: z.array(idSchema).max(10),
labelsRemoved: z.array(idSchema).max(10),
fields: z.array(z.enum(COLLECTION_CARD_FIELDS)).max(8),
fields: z.array(z.enum(COLLECTION_CARD_FIELDS)).max(COLLECTION_CARD_FIELDS.length),
movedTo: collectionCardListSchema.nullable(),
removed: z.boolean(),
});
@@ -86,7 +86,7 @@ describe('collection cards', () => {
const delta = deltaOf({ status: { from: 'idea', to: 'visited' }, rating: { to: null }, fields: ['photo'] });
const card = { ...placesCard, places: [{ ...place, delta }] };
expect(collectionPlacesCardSchema.parse(card).places[0]?.delta).toEqual(delta);
const unknownField = { ...placesCard, places: [{ ...place, delta: deltaOf({ fields: ['phone'] }) }] };
const unknownField = { ...placesCard, places: [{ ...place, delta: deltaOf({ fields: ['email'] }) }] };
expect(collectionPlacesCardSchema.safeParse(unknownField).success).toBe(false);
});