This commit is contained in:
seb
2026-07-27 01:14:36 +02:00
parent c27ad52e2a
commit fc7afd1be8
18 changed files with 902 additions and 9 deletions

View File

@@ -1,4 +1,6 @@
import sql from 'mssql';
import { isDemoMode } from '../demo/mode.js';
import { getDemoCategoryList } from '../demo/store.js';
import { getPool } from '../db.js';
import { CATEGORY_TREE_CTE, categoryTreeRequest, getRootCategoryId } from './category-tree.js';
@@ -26,6 +28,10 @@ ORDER BY lastChanged ASC;
`;
export async function getCategoryList({ cursor = 0, limit = 20, rootCategoryId = getRootCategoryId() } = {}) {
if (isDemoMode()) {
return getDemoCategoryList({ cursor, limit });
}
const result = await categoryTreeRequest(getPool(), rootCategoryId)
.input('cursor', sql.BigInt, cursor)
.input('limit', sql.Int, limit)