fixed error
This commit is contained in:
parent
e890ccf2ed
commit
ffb3a3819c
@ -141,28 +141,36 @@ router.get(
|
|||||||
);
|
);
|
||||||
const role = await RolesDBApi.findBy({ id: roleId });
|
const role = await RolesDBApi.findBy({ id: roleId });
|
||||||
if (!role?.role_customization) {
|
if (!role?.role_customization) {
|
||||||
await Promise.all(["pie", "bar"].map(async (e) => {
|
try {
|
||||||
const schema = await sjs.getSequelizeSchema(db.sequelize, {});
|
await Promise.all(["pie", "bar"].map(async (e) => {
|
||||||
const payload = {
|
const schema = await sjs.getSequelizeSchema(db.sequelize, {});
|
||||||
description: `Create some cool ${e} chart`,
|
const payload = {
|
||||||
modelDefinition: schema.definitions,
|
description: `Create some cool ${e} chart`,
|
||||||
};
|
modelDefinition: schema.definitions,
|
||||||
const widgetId = await getWidget(payload, currentUser?.id, roleId);
|
};
|
||||||
if (widgetId) {
|
const widgetId = await getWidget(payload, currentUser?.id, roleId);
|
||||||
await RolesService.addRoleInfo(
|
if (widgetId) {
|
||||||
roleId,
|
await RolesService.addRoleInfo(
|
||||||
currentUser?.id,
|
roleId,
|
||||||
'widgets',
|
currentUser?.id,
|
||||||
widgetId,
|
'widgets',
|
||||||
req.currentUser,
|
widgetId,
|
||||||
);
|
req.currentUser,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
info = await RolesService.getRoleInfoByKey(
|
||||||
|
key,
|
||||||
|
roleId,
|
||||||
|
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 = [];
|
||||||
}
|
}
|
||||||
}))
|
}
|
||||||
info = await RolesService.getRoleInfoByKey(
|
|
||||||
key,
|
|
||||||
roleId,
|
|
||||||
currentUser,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
res.status(200).send(info);
|
res.status(200).send(info);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -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 }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user