This commit is contained in:
seb
2026-07-31 07:42:19 +02:00
parent 39c5820947
commit 4f98082061
6 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { GET_TREE } from '../../sql/category.js';
import resolveCompanyAccess from '../companyuser/resolveCompanyAccess.js';
export default function getTreeForCompany(pool) {
const access = resolveCompanyAccess(pool);
return async (authId, companyId) => {
const { rootCategoryId } = await access(authId, companyId);
const result = await pool
.request()
.input('rootId', rootCategoryId)
.query(GET_TREE);
return result.recordset;
};
}