Add frontend types and API client methods for region management
Adds RegionalTargetResponse, RegionalBudgetResponse, RegionAgencyMapResponse, RegionalTaxRuleResponse, RegionHierarchyResponse, and RegionDashboardResponse types, plus setTarget/setBudget/mapAgency/setTaxRule/hierarchy/dashboard methods on the regions API client, mirroring the new backend endpoints. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,12 @@ import { api } from '@/lib/api'
|
||||
import type {
|
||||
PaginatedResponse,
|
||||
RegionResponse,
|
||||
RegionalTargetResponse,
|
||||
RegionalBudgetResponse,
|
||||
RegionAgencyMapResponse,
|
||||
RegionalTaxRuleResponse,
|
||||
RegionHierarchyResponse,
|
||||
RegionDashboardResponse,
|
||||
RouteResponse,
|
||||
VehicleResponse,
|
||||
WarehouseResponse,
|
||||
@@ -96,6 +102,24 @@ export const regions = {
|
||||
|
||||
remove: (id: string) =>
|
||||
api.delete(`/regions/${id}`),
|
||||
|
||||
setTarget: (id: string, period: string, targetValue: number) =>
|
||||
api.put<RegionalTargetResponse>(`/regions/${id}/targets/${period}`, { targetValue }).then(r => r.data),
|
||||
|
||||
setBudget: (id: string, period: string, budgetAmount: number) =>
|
||||
api.put<RegionalBudgetResponse>(`/regions/${id}/budgets/${period}`, { budgetAmount }).then(r => r.data),
|
||||
|
||||
mapAgency: (id: string, agencyUserId: string) =>
|
||||
api.post<RegionAgencyMapResponse>(`/regions/${id}/agencies`, { agencyUserId }).then(r => r.data),
|
||||
|
||||
setTaxRule: (id: string, ruleConfig: string) =>
|
||||
api.put<RegionalTaxRuleResponse>(`/regions/${id}/tax-rule`, { ruleConfig }).then(r => r.data),
|
||||
|
||||
hierarchy: (id: string) =>
|
||||
api.get<RegionHierarchyResponse>(`/regions/${id}/hierarchy`).then(r => r.data),
|
||||
|
||||
dashboard: (id: string, period?: string) =>
|
||||
api.get<RegionDashboardResponse>(`/regions/${id}/dashboard`, { params: { period } }).then(r => r.data),
|
||||
}
|
||||
|
||||
// ─── Routes ───────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user