mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
feat(places): remember the Amap id a place was found by
The provider produced amap_poi_id, but nothing stored it, so a saved Amap place could never be reopened against Amap. The column now travels with google_place_id and osm_id through the shared contract, the place insert and update, duplicate matching, the assignment projections, the trip copy and the three place MCP tools.
This commit is contained in:
@@ -35,6 +35,7 @@ export interface PlaceMatchCandidate {
|
||||
google_place_id?: string | null;
|
||||
google_ftid?: string | null;
|
||||
osm_id?: string | null;
|
||||
amap_poi_id?: string | null;
|
||||
}
|
||||
|
||||
/** One way to look for an existing place, to be tried in order. */
|
||||
@@ -51,7 +52,7 @@ export function normalizePlaceName(name: string | null | undefined): string | nu
|
||||
|
||||
/** The provider ids a candidate carries, trimmed, in provider order, blanks dropped. */
|
||||
export function externalIdsOf(candidate: PlaceMatchCandidate): string[] {
|
||||
return [candidate.google_place_id, candidate.google_ftid, candidate.osm_id]
|
||||
return [candidate.google_place_id, candidate.google_ftid, candidate.osm_id, candidate.amap_poi_id]
|
||||
.filter((id): id is string => typeof id === 'string' && id.trim() !== '')
|
||||
.map((id) => id.trim());
|
||||
}
|
||||
|
||||
@@ -135,6 +135,9 @@ export const placeSchema = z.object({
|
||||
google_place_id: z.string().nullable().optional(),
|
||||
google_ftid: z.string().nullable().optional(),
|
||||
osm_id: z.string().nullable().optional(),
|
||||
// The Amap (高德) POI id a place was found by, `amap:`-prefixed. null for every
|
||||
// place that came from another provider.
|
||||
amap_poi_id: z.string().nullable().optional(),
|
||||
route_geometry: z.string().nullable().optional(),
|
||||
// Manual track colour (#776). null = inherit the category colour like before.
|
||||
route_color: hexColorSchema.nullable().optional(),
|
||||
@@ -199,6 +202,7 @@ export const assignmentPlaceSchema = z.object({
|
||||
// Carried on the embedded place so the day-plan thumbnail can auto-fetch an
|
||||
// OSM photo the same way the sidebar/inspector do (#1136 follow-up).
|
||||
osm_id: z.string().nullable().optional(),
|
||||
amap_poi_id: z.string().nullable().optional(),
|
||||
website: z.string().nullable().optional(),
|
||||
phone: z.string().nullable().optional(),
|
||||
// Carried through so the road-trip rail can mark a fuel stop as one without a
|
||||
|
||||
Reference in New Issue
Block a user