mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user