Adds initial models, migrations, and services to support role-based access and sharing; wires routes to prepare for permission-driven features.
9 lines
238 B
JavaScript
9 lines
238 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 };
|