tududi/backend/services/rolesService.js
antanst b8611d9338 chore(lint): remove unnecessary try/catch and tighten error handling
- 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
2025-09-22 15:20:46 +03:00

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 };