tethys.backend/app/Models/utils.ts

19 lines
844 B
TypeScript
Raw Normal View History

2024-03-14 19:25:27 +00:00
// import db from '@adonisjs/lucid/services/db';
// // import Config from '@ioc:Adonis/Core/Config';
// import config from '@adonisjs/core/services/config';
// import { QueryClientContract } from "@adonisjs/lucid/types/database";
// import { TransactionClientContract } from "@adonisjs/lucid/types/database";
2023-03-03 15:54:28 +00:00
2024-03-14 19:25:27 +00:00
// export function getUserRoles(userId: number, trx?: TransactionClientContract): Promise<Array<string>> {
// const { userRole } = config.get('acl.joinTables');
// return ((trx || db) as QueryClientContract | TransactionClientContract)
// .query()
// .from('roles')
// .distinct('roles.slug')
// .leftJoin(userRole, `${userRole}.role_id`, 'roles.id')
// .where(`${userRole}.user_id`, userId)
// .then((res) => {
// return res.map((r) => r.slug);
// });
// }