refactor(maps): the searchText field mask lives beside the Google places provider

This commit is contained in:
Maurice
2026-10-10 11:39:20 +02:00
parent 526b2c105a
commit 3618a4ab9f
6 changed files with 14 additions and 15 deletions
@@ -35,7 +35,6 @@
"admin -> llm-parse/llm-config.ts",
"atlas -> geo/nominatim.client.ts",
"atlas -> public-api/public-api-request.ts",
"auth -> maps/maps.helpers.ts",
"auth -> maps/providers/places-provider.ts",
"auth -> plugins/paths.ts",
"auth -> plugins/user-erasure-enqueue.ts",
+1 -1
View File
@@ -15,7 +15,7 @@ import {
writeInstanceApiKey,
type InstanceApiKeyName,
} from '../settings/instance-api-keys';
import { SEARCH_TEXT_FIELD_MASK } from '../maps/maps.helpers';
import { SEARCH_TEXT_FIELD_MASK } from '../maps/providers/google-places.constants';
import { AppSettings } from '../../db/entities/AppSettings.entity';
import type { AppSettingsRepository } from '../../db/repositories/AppSettings.repository';
import { Users } from '../../db/entities/Users.entity';
-11
View File
@@ -26,17 +26,6 @@ export function buildUserAgent(instanceUrl: string | undefined): string {
// Computed once at load — getAppUrl() reads only env vars, which don't change at runtime.
export const UA = buildUserAgent(getAppUrl());
/**
* The fields places:searchText is asked for.
*
* Here rather than beside the call because the admin panel's key test has to
* send the same mask: a key restricted to a narrower set of Places SKUs answers
* a one-field probe with 200 and the real search with 403, which is the second
* way to reach the #1939 report ("test button green, searching fails").
*/
export const SEARCH_TEXT_FIELD_MASK =
'places.id,places.displayName,places.formattedAddress,places.location,places.rating,places.websiteUri,places.nationalPhoneNumber,places.types,places.googleMapsUri,places.businessStatus';
// TREK's internal language codes mostly coincide with valid BCP-47 codes, but a
// couple don't: 'br' is Brazilian Portuguese here (BCP-47 'pt-BR'; bare 'br' is
// Breton) and 'gr' is Greek (BCP-47 'el'). Outbound geo APIs (Google Places,
+1 -1
View File
@@ -23,6 +23,7 @@ import type { PlaceDetailsCacheRepository } from '../../db/repositories/PlaceDet
import { Places } from '../../db/entities/Places.entity';
import type { PlacesRepository } from '../../db/repositories/Places.repository';
import { isPlacesProviderChoice, type PlacesProviderChoice } from './providers/places-provider';
import { SEARCH_TEXT_FIELD_MASK } from './providers/google-places.constants';
import {
AMAP_SHORT_HOSTS,
AmapPlacesProvider,
@@ -49,7 +50,6 @@ import {
} from './trek-places.client';
import {
UA,
SEARCH_TEXT_FIELD_MASK,
toApiLang,
googleFtidFromMapsUrl,
buildOsmDetails,
@@ -0,0 +1,11 @@
/**
* The fields places:searchText is asked for.
*
* Beside the Google places provider that sends them, and in a constants file
* because the admin panel's key test (auth/user-profile.service.ts) has to send
* the same mask: a key restricted to a narrower set of Places SKUs answers a
* one-field probe with 200 and the real search with 403, which is the second
* way to reach the #1939 report ("test button green, searching fails").
*/
export const SEARCH_TEXT_FIELD_MASK =
'places.id,places.displayName,places.formattedAddress,places.location,places.rating,places.websiteUri,places.nationalPhoneNumber,places.types,places.googleMapsUri,places.businessStatus';
@@ -53,7 +53,7 @@ async function setUserColumns(
): Promise<void> {
await updateRows(await sharedTestOrm(testDb), Users, { id: userId }, data);
}
import { SEARCH_TEXT_FIELD_MASK } from '../../../src/nest/maps/maps.helpers';
import { SEARCH_TEXT_FIELD_MASK } from '../../../src/nest/maps/providers/google-places.constants';
const avatarsFx = makeStorageFixture('avatars/');
let profile: UserProfileService;