This commit is contained in:
seb
2026-10-16 13:51:18 +02:00
parent d851c6e1e9
commit 764d6f850a
12 changed files with 2211 additions and 328 deletions

View File

@@ -29,15 +29,20 @@ export const article = {
},
/**
* GET /api/article/history
* History of all articles with paging/sorting/filtering
* 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]
* → { history: ArticleHistoryEntry[], total: number, unfilteredTotal?: number }
*/
getHistory({ startRow, endRow, offset, limit, sortModel, filterModel } = {}) {
getHistory({ offset = 0, limit = 50, search, seekMonths, startRow, endRow, 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));
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))));
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))));
}
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();