diff --git a/web-v2/src/lib/inventoryBrowserApi.ts b/web-v2/src/lib/inventoryBrowserApi.ts index e8dd372..410cad4 100644 --- a/web-v2/src/lib/inventoryBrowserApi.ts +++ b/web-v2/src/lib/inventoryBrowserApi.ts @@ -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)}`,