This commit is contained in:
seb
2026-09-26 23:05:48 +02:00
parent 454c5ab6bf
commit 3ab9d904e6
12 changed files with 1505 additions and 65 deletions

View File

@@ -633,6 +633,58 @@ export const supplier = {
},
};
/**
* Company-scoped warehouses / Lager (selectedCompanyId from session).
* Shape: Warehouse = { id, name }
*/
export const warehouse = {
/** GET /api/warehouse → { warehouses: Warehouse[] } */
list() {
return http('/api/warehouse');
},
/** GET /api/warehouse/:id → { warehouse: Warehouse } */
getById(id) {
return http(`/api/warehouse/${id}`);
},
/**
* POST /api/warehouse
* Body: { name } — empty name ⇒ 400 Name required.
* → 201 { warehouse: Warehouse }
*/
create(body) {
return http('/api/warehouse', { method: 'POST', body });
},
/**
* PATCH /api/warehouse/:id
* Body: { name } — empty name ⇒ 400 Name required.
* → 200 { warehouse: Warehouse }
*/
update(id, body) {
return http(`/api/warehouse/${id}`, { method: 'PATCH', body });
},
/** DELETE /api/warehouse/:id → 204 */
delete(id) {
return http(`/api/warehouse/${id}`, { method: 'DELETE' });
},
};
/**
* Stock operations (manual stock adjustment).
*/
export const stock = {
/**
* POST /api/stock/adjust
* Body: { sku, warehouseId, amount, text?, date?, externalNumber?, lines? }
*/
adjust(body) {
return http('/api/stock/adjust', { method: 'POST', body });
},
};
/**
* Company-scoped goods receipts (manifest type = delivery).
* DeliverySummary = { id, number, externalNumber, type: 'delivery', supplierId, date }
@@ -1264,4 +1316,6 @@ export default {
supplier,
thumb,
unit,
warehouse,
stock,
};