chore: add new route to get admin permissons

This commit is contained in:
mahyargdz
2025-04-20 09:51:29 +03:30
parent dc25c19ed8
commit a2088e6176
4 changed files with 21 additions and 4 deletions
@@ -86,6 +86,16 @@ export class AdminsService {
}
/************************************************************ */
async getAdminPermissions(userId: string) {
const user = await this.userRepository.findOne({ where: { id: userId }, relations: { roles: { permissions: true } } });
if (!user) throw new BadRequestException(UserMessage.USER_NOT_FOUND);
return {
permissions: user.roles[0].permissions,
};
}
/************************************************************ */
async getRoles(queryDto: SearchRolesQueryDto) {
const { limit, skip } = PaginationUtils(queryDto);
const queryBuilder = this.rolesRepository.createQueryBuilder("role");