u
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user