clean
This commit is contained in:
@@ -42,7 +42,7 @@ export class RestaurantsController {
|
||||
@ApiOperation({ summary: 'Get restaurant by ID from request' })
|
||||
@Get('admin/restaurants/my-restaurant')
|
||||
async findOne(@RestId() restId: string) {
|
||||
return await this.restaurantsService.findOne(restId);
|
||||
return await this.restaurantsService.findOneOrFail(restId);
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@@ -96,7 +96,7 @@ export class RestaurantsController {
|
||||
@ApiParam({ name: 'id', required: true, description: 'Restaurant ID' })
|
||||
@Get('super-admin/restaurants/:id')
|
||||
findOneById(@Param('id') id: string) {
|
||||
return this.restaurantsService.findOne(id);
|
||||
return this.restaurantsService.findOneOrFail(id);
|
||||
}
|
||||
|
||||
@UseGuards(SuperAdminAuthGuard)
|
||||
|
||||
@@ -128,7 +128,7 @@ export class RestaurantsService {
|
||||
return restaurant;
|
||||
}
|
||||
|
||||
async findOne(id: string): Promise<Restaurant> {
|
||||
async findOneOrFail(id: string): Promise<Restaurant> {
|
||||
const restaurant = await this.restRepository.findOne({ id });
|
||||
|
||||
if (!restaurant) {
|
||||
|
||||
@@ -16,6 +16,6 @@ import { AuthModule } from '../auth/auth.module';
|
||||
controllers: [RestaurantsController, ScheduleController],
|
||||
providers: [RestaurantsService, RestRepository, ScheduleRepository, ScheduleService, RestaurantCrone],
|
||||
imports: [MikroOrmModule.forFeature([Restaurant, Schedule]), JwtModule, forwardRef(() => AuthModule)],
|
||||
exports: [RestRepository, ScheduleRepository, ScheduleService],
|
||||
exports: [RestRepository, ScheduleRepository, ScheduleService, RestaurantsService],
|
||||
})
|
||||
export class RestaurantsModule {}
|
||||
export class RestaurantsModule { }
|
||||
|
||||
Reference in New Issue
Block a user