feat: closes #11747, add pagination to tokens page

This commit is contained in:
Barış Soner Uşaklı
2023-06-22 23:38:57 -04:00
parent c4c06be5a8
commit 4b11cd0da5
3 changed files with 18 additions and 6 deletions

View File

@@ -10,12 +10,14 @@ const utils = module.exports;
// internal token management utilities only
utils.tokens = {};
utils.tokens.list = async () => {
utils.tokens.list = async (start = 0, stop = -1) => {
// Validation handled at higher level
const tokens = await db.getSortedSetRange(`tokens:createtime`, 0, -1);
const tokens = await db.getSortedSetRange(`tokens:createtime`, start, stop);
return await utils.tokens.get(tokens);
};
utils.tokens.count = async () => await db.sortedSetCard('tokens:createtime');
utils.tokens.get = async (tokens) => {
// Validation handled at higher level
if (!tokens) {