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:
@@ -45,6 +45,7 @@ function parseFullHash(value) {
|
||||
}
|
||||
|
||||
function articleErrorStatus(error) {
|
||||
if (error.message === 'No company selected') return 400;
|
||||
if (error.message === 'Not authorized') return 403;
|
||||
if (error.message === 'Parent not found') return 404;
|
||||
if (error.message === 'Article not found') return 404;
|
||||
@@ -230,7 +231,7 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
|
||||
try {
|
||||
const rows = await db.listExport(req.user.id, companyId, categoryId);
|
||||
const rows = await db.listExport(req.user.id, categoryId);
|
||||
|
||||
const csv = buildArtikelCsv(rows);
|
||||
|
||||
@@ -1376,7 +1377,7 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
|
||||
try {
|
||||
const articles = await db.listSearchIndex(req.user.id, companyId);
|
||||
const articles = await db.listSearchIndex(req.user.id);
|
||||
res.status(200).json({ articles });
|
||||
} catch (error) {
|
||||
const status = articleErrorStatus(error);
|
||||
|
||||
Reference in New Issue
Block a user