u
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -2,16 +2,22 @@ import { http } from './http.js';
|
||||
|
||||
export const globalHistory = {
|
||||
/**
|
||||
* GET /api/history
|
||||
* Global system/entity history with paging/sorting/filtering
|
||||
* GET /api/history?offset=0&limit=50&search=...&seekMonths=-1
|
||||
* Global system/entity history with chunk paging and search/seek filtering
|
||||
* @param {{ offset?: number, limit?: number, search?: string, seekMonths?: number, startRow?: number, endRow?: number }} [params]
|
||||
* → { history: GlobalHistoryEntry[], total: number, unfilteredTotal?: number }
|
||||
*/
|
||||
// #region GET /api/history — list
|
||||
list({ startRow, endRow, offset, limit, sortModel, filterModel } = {}) {
|
||||
list({ 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();
|
||||
|
||||
Reference in New Issue
Block a user