This commit is contained in:
seb
2026-10-03 07:32:29 +02:00
parent bc4a1e0468
commit c79ece307c
19 changed files with 622 additions and 69 deletions

View File

@@ -215,6 +215,32 @@ export const article = {
return http(`/api/article/${encodeURIComponent(sku)}`);
},
/**
* GET /api/article/history
* History of all articles with paging/sorting/filtering
*/
getHistory({ startRow, endRow, offset, limit, sortModel, filterModel } = {}) {
const params = new URLSearchParams();
if (startRow != null) params.set('startRow', String(startRow));
if (endRow != null) params.set('endRow', String(endRow));
if (offset != null) params.set('offset', String(offset));
if (limit != null) params.set('limit', String(limit));
if (sortModel && sortModel.length) params.set('sort', JSON.stringify(sortModel));
if (filterModel && Object.keys(filterModel).length) params.set('filter', JSON.stringify(filterModel));
const qs = params.toString();
return http(`/api/article/history${qs ? `?${qs}` : ''}`);
},
/**
* GET /api/article/:sku/history
*/
getBySkuHistory(sku, { limit } = {}) {
const params = new URLSearchParams();
if (limit != null) params.set('limit', String(limit));
const qs = params.toString();
return http(`/api/article/${encodeURIComponent(sku)}/history${qs ? `?${qs}` : ''}`);
},
/** POST /api/article → 201 { article } */
create({ parentId, name, track_stock }) {
return http('/api/article', {
@@ -1797,6 +1823,24 @@ export const labeltemplate = {
// thumb is returned inline as a base64 string in list/get responses
};
export const globalHistory = {
/**
* GET /api/history
* Global system/entity history with paging/sorting/filtering
*/
list({ startRow, endRow, offset, limit, sortModel, filterModel } = {}) {
const params = new URLSearchParams();
if (startRow != null) params.set('startRow', String(startRow));
if (endRow != null) params.set('endRow', String(endRow));
if (offset != null) params.set('offset', String(offset));
if (limit != null) params.set('limit', String(limit));
if (sortModel && sortModel.length) params.set('sort', JSON.stringify(sortModel));
if (filterModel && Object.keys(filterModel).length) params.set('filter', JSON.stringify(filterModel));
const qs = params.toString();
return http(`/api/history${qs ? `?${qs}` : ''}`);
},
};
export default {
auth,
article,
@@ -1822,4 +1866,5 @@ export default {
unit,
warehouse,
stock,
globalHistory,
};