permission update

This commit is contained in:
Julian Krauser 2024-08-28 20:41:16 +02:00
parent 9808100d81
commit 6865507545
6 changed files with 100 additions and 5 deletions

View file

@ -3,6 +3,23 @@ import { role } from "../entity/role";
import InternalException from "../exceptions/internalException";
export default abstract class RoleService {
/**
* @description get roles
* @returns {Promise<Array<role>>}
*/
static async getAll(): Promise<Array<role>> {
return await dataSource
.getRepository(role)
.createQueryBuilder("role")
.getMany()
.then((res) => {
return res;
})
.catch((err) => {
throw new InternalException("roles not found");
});
}
/**
* @description get role by id
* @param id number