inventory

This commit is contained in:
2026-03-14 21:23:22 -05:00
parent d21e2e3c0b
commit 472c36915c
14 changed files with 730 additions and 1 deletions

View File

@@ -27,6 +27,9 @@ import type {
InventoryItemStatus,
InventoryItemSummaryDto,
InventoryItemType,
WarehouseDetailDto,
WarehouseInput,
WarehouseSummaryDto,
} from "@mrp/shared/dist/inventory/types.js";
export class ApiError extends Error {
@@ -315,6 +318,32 @@ export const api = {
token
);
},
getWarehouses(token: string) {
return request<WarehouseSummaryDto[]>("/api/v1/inventory/warehouses", undefined, token);
},
getWarehouse(token: string, warehouseId: string) {
return request<WarehouseDetailDto>(`/api/v1/inventory/warehouses/${warehouseId}`, undefined, token);
},
createWarehouse(token: string, payload: WarehouseInput) {
return request<WarehouseDetailDto>(
"/api/v1/inventory/warehouses",
{
method: "POST",
body: JSON.stringify(payload),
},
token
);
},
updateWarehouse(token: string, warehouseId: string, payload: WarehouseInput) {
return request<WarehouseDetailDto>(
`/api/v1/inventory/warehouses/${warehouseId}`,
{
method: "PUT",
body: JSON.stringify(payload),
},
token
);
},
getGanttDemo(token: string) {
return request<{ tasks: GanttTaskDto[]; links: GanttLinkDto[] }>("/api/v1/gantt/demo", undefined, token);
},