fixed error

This commit is contained in:
Dmitri 2026-03-19 07:36:50 +04:00
parent e890ccf2ed
commit ffb3a3819c
2 changed files with 30 additions and 23 deletions

View File

@ -141,6 +141,7 @@ router.get(
); );
const role = await RolesDBApi.findBy({ id: roleId }); const role = await RolesDBApi.findBy({ id: roleId });
if (!role?.role_customization) { if (!role?.role_customization) {
try {
await Promise.all(["pie", "bar"].map(async (e) => { await Promise.all(["pie", "bar"].map(async (e) => {
const schema = await sjs.getSequelizeSchema(db.sequelize, {}); const schema = await sjs.getSequelizeSchema(db.sequelize, {});
const payload = { const payload = {
@ -157,12 +158,19 @@ router.get(
req.currentUser, req.currentUser,
); );
} }
})) }));
info = await RolesService.getRoleInfoByKey( info = await RolesService.getRoleInfoByKey(
key, key,
roleId, roleId,
currentUser, currentUser,
); );
} catch (error) {
console.warn('Widget creation skipped (external API unavailable):', error.message);
// Return empty widgets when external API is unavailable
if (key === 'widgets') {
info = [];
}
}
} }
res.status(200).send(info); res.status(200).send(info);
}), }),

View File

@ -379,7 +379,6 @@ router.get('/count', wrapAsync(async (req, res) => {
const runtimeContext = req.runtimeContext; const runtimeContext = req.runtimeContext;
const payload = await ProjectsDBApi.findAll( const payload = await ProjectsDBApi.findAll(
req.query, req.query,
null,
{ countOnly: true, currentUser, runtimeContext } { countOnly: true, currentUser, runtimeContext }
); );