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 { getDemoCategoryCount } from '../demo/store.js';
import { getPool } from '../db.js';
import { CATEGORY_TREE_CTE, categoryTreeRequest, getRootCategoryId } from './category-tree.js';
@@ -12,6 +14,10 @@ WHERE k.kKategorie IN (SELECT kKategorie FROM CategoryTree)
`;
export async function getCategoryCount({ cursor = 0, rootCategoryId = getRootCategoryId() } = {}) {
if (isDemoMode()) {
return getDemoCategoryCount({ cursor });
}
const result = await categoryTreeRequest(getPool(), rootCategoryId)
.input('cursor', sql.BigInt, cursor)
.query(CATEGORY_COUNT_SQL);