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