feat(web): add inventory classification administration API
This commit is contained in:
@@ -7,11 +7,16 @@ export interface InventoryFamily {
|
||||
code: string;
|
||||
name: string;
|
||||
level: 'INSTALLATION' | 'SUBINSTALLATION';
|
||||
legacyTypeCode: string | null;
|
||||
legacyTypeCode?: string | null;
|
||||
informationLabels: string[];
|
||||
sourceReference?: string | null;
|
||||
isActive?: boolean;
|
||||
parentFamilyId: string | null;
|
||||
parentFamilyCode: string | null;
|
||||
parentFamilyName: string | null;
|
||||
assetCount?: number;
|
||||
findingCount?: number;
|
||||
findingItemIds?: string[];
|
||||
}
|
||||
|
||||
export interface InventoryStructureLevel {
|
||||
@@ -107,6 +112,41 @@ export function getInventoryFamilyFindings(familyId: string) {
|
||||
return apiRequest<InventoryFamilyFindings>(`/inventory-families/${familyId}/findings`);
|
||||
}
|
||||
|
||||
export async function listInventoryFamiliesAdmin() {
|
||||
return (await apiRequest<{ data: InventoryFamily[] }>('/inventory-families/admin')).data;
|
||||
}
|
||||
|
||||
export function createInventoryFamily(input: {
|
||||
level: 'INSTALLATION' | 'SUBINSTALLATION';
|
||||
name: string;
|
||||
parentFamilyId?: string | null;
|
||||
informationLabels?: string[];
|
||||
}) {
|
||||
return apiRequest<InventoryFamily>('/inventory-families', {
|
||||
method: 'POST', body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export function updateInventoryFamily(familyId: string, input: {
|
||||
name?: string;
|
||||
parentFamilyId?: string | null;
|
||||
informationLabels?: string[];
|
||||
isActive?: boolean;
|
||||
}) {
|
||||
return apiRequest<InventoryFamily>(`/inventory-families/${familyId}`, {
|
||||
method: 'PATCH', body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export function replaceInventoryFamilyFindings(familyId: string, input: {
|
||||
itemIds: string[];
|
||||
reason: string;
|
||||
}) {
|
||||
return apiRequest<InventoryFamilyFindings>(`/inventory-families/${familyId}/findings`, {
|
||||
method: 'PUT', body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export function createInventoryStructure(input: {
|
||||
kind: InventoryStructureKind;
|
||||
code?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user