F5.1: API web para Departamentos, Empresas y árbol completo

This commit is contained in:
2026-09-09 07:50:26 -03:00
parent 40da9dcc0a
commit 3f3764c54b
+39 -1
View File
@@ -6,6 +6,28 @@ import type {
PageMeta,
} from './api';
export interface InventoryBrowserDepartment {
id: string;
code: string;
name: string;
commonName: string | null;
type: { id: string; code: string; name: string };
informationStatus: AssetInformationStatus;
operationalStatus: AssetOperationalStatus;
areaCount: number;
childrenCount: number;
}
export interface InventoryBrowserCompany {
id: string;
code: string;
name: string;
commonName: string | null;
type: { id: string; code: string; name: string };
informationStatus: AssetInformationStatus;
areaCount: number;
}
export interface InventoryBrowserArea {
id: string;
code: string;
@@ -31,6 +53,7 @@ export interface InventoryBrowserItem {
isInventoryInstance: boolean;
inventoryFamily: { id: string; code: string; name: string; level: string } | null;
childrenCount: number;
findingCount: number;
hasGeometry: boolean;
updatedAt: string;
}
@@ -85,12 +108,27 @@ function queryString(params: InventoryQuery): string {
return query.size ? `?${query}` : '';
}
export function listRealInventory(params: InventoryQuery = {}) {
export function listInventory(params: InventoryQuery = {}) {
return apiRequest<{ data: InventoryListItem[]; meta: PageMeta }>(
`/inventory-browser/items${queryString(params)}`,
);
}
// Compatibility alias while old call sites are removed.
export const listRealInventory = listInventory;
export function listInventoryDepartments(params: InventoryQuery = {}) {
return apiRequest<{ data: InventoryBrowserDepartment[]; meta: { count: number } }>(
`/inventory-browser/departments${queryString(params)}`,
);
}
export function listInventoryCompanies(params: InventoryQuery = {}) {
return apiRequest<{ data: InventoryBrowserCompany[]; meta: { count: number } }>(
`/inventory-browser/companies${queryString(params)}`,
);
}
export function listInventoryAreas(params: InventoryQuery = {}) {
return apiRequest<{ data: InventoryBrowserArea[]; meta: { count: number } }>(
`/inventory-browser/areas${queryString(params)}`,