get rest admina

This commit is contained in:
2025-12-29 15:20:00 +03:30
parent e8787be08e
commit cfc0366eca
2 changed files with 25 additions and 7 deletions
@@ -119,6 +119,13 @@ export class AdminService {
return admin;
}
async getAdminsForRestaurantBySuperAdmin(restId: string): Promise<Admin[]> {
const restaurant = await this.em.findOne(Restaurant, { id: restId });
if (!restaurant) throw new NotFoundException('Restaurant not found');
return this.adminRepository.find({ roles: { restaurant: restaurant } }, { populate: ['roles', 'roles.role'] });
}
async update(adminId: string, restId: string, dto: UpdateAdminDto): Promise<Admin> {
const admin = await this.adminRepository.findOne(
{ id: adminId, roles: { restaurant: { id: restId } } },