This commit is contained in:
2025-12-29 23:08:18 +03:30
parent 9f0ca2fe02
commit 6f972a9e12
2 changed files with 6 additions and 9 deletions
@@ -2,7 +2,7 @@ import { Controller, Post, Body, HttpCode, HttpStatus, Get, UseGuards, Patch, Pa
import { AdminService } from '../providers/admin.service'; import { AdminService } from '../providers/admin.service';
import { CreateAdminDto } from '../dto/create-admin.dto'; import { CreateAdminDto } from '../dto/create-admin.dto';
import { UpdateAdminDto } from '../dto/update-admin.dto'; import { UpdateAdminDto } from '../dto/update-admin.dto';
import { ApiTags, ApiOperation, ApiBody, ApiBearerAuth, ApiParam, ApiHeader } from '@nestjs/swagger'; import { ApiTags, ApiOperation, ApiBody, ApiBearerAuth, ApiParam } from '@nestjs/swagger';
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard'; import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
import { SuperAdminAuthGuard } from 'src/modules/auth/guards/superAdminAuth.guard'; import { SuperAdminAuthGuard } from 'src/modules/auth/guards/superAdminAuth.guard';
import { RestId } from 'src/common/decorators'; import { RestId } from 'src/common/decorators';
@@ -80,10 +80,7 @@ export class AdminController {
@Get('super-admin/restaurants/:restaurantId/admins') @Get('super-admin/restaurants/:restaurantId/admins')
@ApiOperation({ summary: 'Get admins for a specific restaurant (Super Admin only)' }) @ApiOperation({ summary: 'Get admins for a specific restaurant (Super Admin only)' })
@ApiParam({ name: 'restaurantId', description: 'Restaurant ID' }) @ApiParam({ name: 'restaurantId', description: 'Restaurant ID' })
getAdminForRestaurant(@Param('restaurantId') restaurantId: string): Promise<Admin[]> {
getAdminForRestaurant(
@Param('restaurantId') restaurantId: string,
): Promise<Admin[]> {
return this.adminService.getAdminsForRestaurantBySuperAdmin(restaurantId); return this.adminService.getAdminsForRestaurantBySuperAdmin(restaurantId);
} }
+2 -2
View File
@@ -94,8 +94,8 @@ export class AdminService {
}); });
await this.em.persistAndFlush(admin); await this.em.persistAndFlush(admin);
} }
const role = await this.em.findOne(Role, { id: roleId, isSystem: false }); const role = await this.em.findOne(Role, { id: roleId });
if (!role) throw new NotFoundException('Role not found'); if (!role) throw new NotFoundException('Role* not found' + roleId);
const restaurant = await this.em.findOne(Restaurant, { id: restId }); const restaurant = await this.em.findOne(Restaurant, { id: restId });
if (!restaurant) throw new NotFoundException('Restaurant not found'); if (!restaurant) throw new NotFoundException('Restaurant not found');