This commit is contained in:
seb
2026-07-12 21:46:49 +02:00
parent 7f6095013b
commit ee09434ea9
10 changed files with 54 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import sql from 'mssql';
import { getActiveShopId } from '../shop.js';
export const CATEGORY_TREE_CTE = `
WITH CategoryTree AS (
@@ -14,5 +15,8 @@ export function getRootCategoryId() {
}
export function categoryTreeRequest(pool, rootCategoryId = getRootCategoryId()) {
return pool.request().input('rootCategoryId', sql.Int, rootCategoryId);
return pool
.request()
.input('rootCategoryId', sql.Int, rootCategoryId)
.input('kShop', sql.Int, getActiveShopId());
}