tethys.backend/app/Models/utils.ts
Arno Kaimbacher cb51a4136f
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m15s
- update to AdonisJS 6
2024-03-14 20:25:27 +01:00

19 lines
844 B
TypeScript

// 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";
// 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);
// });
// }