u
This commit is contained in:
@@ -50,11 +50,19 @@ export const article = {
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* GET /api/article/:sku/history
|
||||
* GET /api/article/:sku/history?offset=0&limit=50&search=...&seekMonths=-1
|
||||
* @param {string} sku
|
||||
* @param {{ offset?: number, limit?: number, search?: string, seekMonths?: number }} [params]
|
||||
* → { history: ArticleHistoryEntry[], total: number, unfilteredTotal?: number, offset: number, limit: number }
|
||||
*/
|
||||
getBySkuHistory(sku, { limit } = {}) {
|
||||
getBySkuHistory(sku, { offset = 0, limit = 50, search, seekMonths } = {}) {
|
||||
const params = new URLSearchParams();
|
||||
if (limit != null) params.set('limit', String(limit));
|
||||
if (offset != null) params.set('offset', String(Math.max(0, Math.floor(Number(offset) || 0))));
|
||||
if (limit != null) 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))));
|
||||
}
|
||||
const qs = params.toString();
|
||||
return http(`/api/article/${encodeURIComponent(sku)}/history${qs ? `?${qs}` : ''}`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user