u
This commit is contained in:
17
src/store/category/getTreeForCompany.js
Normal file
17
src/store/category/getTreeForCompany.js
Normal 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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user