Add company-scoped delivery store on manifest

This commit is contained in:
seb
2026-08-06 05:32:48 +02:00
parent 4f46967f28
commit 0b7e40ac9c
14 changed files with 2133 additions and 1375 deletions

View File

@@ -0,0 +1,20 @@
import resolveCompanyAccess from '../companyuser/resolveCompanyAccess.js';
import { loadDelivery } from './helpers.js';
export default function getById(pool) {
const access = resolveCompanyAccess(pool);
return async (googleAuthId, companyId, id) => {
if (!Number.isFinite(id)) {
throw new Error('Delivery not found');
}
await access(googleAuthId, companyId);
const delivery = await loadDelivery(pool, null, companyId, id);
if (!delivery) {
throw new Error('Delivery not found');
}
return delivery;
};
}