Align store calls with selected-company scoping and add entity numbers.
Drop companyId from company-scoped store wrappers and routes, add GET /entity/next-number plus optional number on entity create/update, and document dashdbschema API.md lookup in sibling-repos.
This commit is contained in:
@@ -23,6 +23,7 @@ function parsePositiveInt(value, field) {
|
||||
}
|
||||
|
||||
function categoryErrorStatus(error) {
|
||||
if (error.message === 'No company selected') return 400;
|
||||
if (error.message === 'Not authorized') return 403;
|
||||
if (error.message === 'Company not found') return 404;
|
||||
if (error.message === 'Parent not found') return 404;
|
||||
@@ -103,7 +104,7 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await db.getTreeForCompany(req.user.id, companyId);
|
||||
const result = await db.getTreeForCompany(req.user.id);
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
const status = categoryErrorStatus(error);
|
||||
@@ -166,7 +167,7 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
|
||||
try {
|
||||
const { tree } = await db.getTreeForCompany(req.user.id, companyId);
|
||||
const { tree } = await db.getTreeForCompany(req.user.id);
|
||||
|
||||
const csv = buildKategorienCsv(tree, tree.find((n) => n.parentId == null)?.id ?? null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user