This commit is contained in:
seb
2026-10-16 22:27:34 +02:00
parent 0851c31970
commit 5d8ac3a8eb
6 changed files with 62 additions and 58 deletions

View File

@@ -30,15 +30,14 @@ export const article = {
/**
* GET /api/article/history?offset=0&limit=50&search=...&seekMonths=-1
* @param {{ offset?: number, limit?: number, search?: string, seekMonths?: number, startRow?: number, endRow?: number }} [params]
* @param {{ offset?: number, limit?: number, search?: string, seekMonths?: number, sortModel?: Array, filterModel?: object }} [params]
* → { history: ArticleHistoryEntry[], total: number, unfilteredTotal?: number }
*/
getHistory({ offset = 0, limit = 50, search, seekMonths, startRow, endRow, sortModel, filterModel } = {}) {
// #region GET /api/article/history — getHistory
getHistory({ offset = 0, limit = 50, search, seekMonths, sortModel, filterModel } = {}) {
const params = new URLSearchParams();
const finalOffset = offset != null ? offset : (startRow != null ? startRow : 0);
const finalLimit = limit != null ? limit : (endRow != null && startRow != null ? endRow - startRow : 50);
params.set('offset', String(Math.max(0, Math.floor(Number(finalOffset) || 0))));
params.set('limit', String(Math.max(1, Math.floor(Number(finalLimit) || 50))));
params.set('offset', String(Math.max(0, Math.floor(Number(offset) || 0))));
params.set('limit', String(Math.max(1, Math.floor(Number(limit) || 50))));
if (search && String(search).trim()) params.set('search', String(search).trim());
if (seekMonths != null && Number(seekMonths) < 0) {
params.set('seekMonths', String(Math.floor(Number(seekMonths))));
@@ -48,6 +47,7 @@ export const article = {
const qs = params.toString();
return http(`/api/article/history${qs ? `?${qs}` : ''}`);
},
// #endregion
/**
* GET /api/article/:sku/history