From 471f4e8e640f1934a50ba555a4c4729c93a33a59 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Fri, 1 Aug 2025 17:05:05 +0200 Subject: [PATCH] Add synonyms to db.sequence.get() options --- lib/www/server/lib/db/sequence/get.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/www/server/lib/db/sequence/get.js b/lib/www/server/lib/db/sequence/get.js index f30c95c..01e992e 100644 --- a/lib/www/server/lib/db/sequence/get.js +++ b/lib/www/server/lib/db/sequence/get.js @@ -28,8 +28,8 @@ async function get (projectId, sequence, opts = {}) { ]; const sortKey = opts.sortBy && sortFields.includes(opts.sortBy) && opts.sortBy || "tstamp"; const sortDir = opts.sortDesc == "false" ? "ASC" : "DESC"; - const offset = Math.abs((opts.page-1)*opts.itemsPerPage) || 0; - const limit = Math.abs(Number(opts.itemsPerPage)) || null; + const offset = Math.abs(opts.offset) || Math.abs((opts.page-1)*opts.itemsPerPage) || 0; + const limit = Math.abs(opts.limit) || Math.abs(Number(opts.itemsPerPage)) || null; const restriction = sequence != 0 ? "sequence = $3"