- Projects: remove superfluous try/catch around toast; keep explicit error path - AdminUsers/Sidebar/ShareService: keep minimal catch blocks only to ignore non-JSON parse failures, without swallowing errors - Lint/format pass remains green
9 lines
244 B
JavaScript
9 lines
244 B
JavaScript
const { Role } = require('../models');
|
|
|
|
async function isAdmin(userId) {
|
|
if (!userId) return false;
|
|
const role = await Role.findOne({ where: { user_id: userId } });
|
|
return !!(role && role.is_admin);
|
|
}
|
|
|
|
module.exports = { isAdmin };
|