feat(admin): a daily limit on Google API calls

Admin > Settings > Google options gets a daily limit with today's count beside it. Every call through the Places and Routes clients is counted per UTC day; once the limit is reached the Google key reads as absent until the next day, so search, details and photos fall back to OpenStreetMap the way a keyless install does, and the admin sees that the day is used up. (#1582)
This commit is contained in:
Maurice
2026-10-01 12:15:38 +02:00
parent 5138358d7b
commit 7acf7f5655
66 changed files with 898 additions and 78 deletions
+16
View File
@@ -54,6 +54,22 @@ export const adminFeatureToggleRequestSchema = z.object({
});
export type AdminFeatureToggleRequest = z.infer<typeof adminFeatureToggleRequestSchema>;
/**
* PUT /api/admin/google-quota (#1582): the most Google API calls TREK may make
* in one UTC day. Null or 0 removes the ceiling.
*/
export const googleQuotaUpdateRequestSchema = z.object({
daily_limit: z.number().int().min(0).max(10_000_000).nullable(),
});
export type GoogleQuotaUpdateRequest = z.infer<typeof googleQuotaUpdateRequestSchema>;
/** The ceiling as stored, today's count, and whether Google is paused until tomorrow. */
export interface GoogleQuotaStatus {
daily_limit: number | null;
used_today: number;
exhausted: boolean;
}
// Shared by all six packing-template create/update routes. `name` is optional so
// the service's 'Name is required' / 'Category name is required' / 'Item name is
// required' 400s stay the contract, and so the update routes keep treating a