mt restaurent
This commit is contained in:
@@ -29,15 +29,12 @@ export class RestaurantsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@ApiOperation({ summary: 'Get a restaurant by slug' })
|
@ApiOperation({ summary: 'Get restaurant by ID from request' })
|
||||||
@ApiResponse({ status: 200, description: 'Restaurant found' })
|
|
||||||
@ApiNotFoundResponse({ type: NotFoundException, description: 'Restaurant not found' })
|
|
||||||
@Get(':slug')
|
|
||||||
@ApiOperation({ summary: 'Get a restaurant by slug' })
|
|
||||||
@ApiResponse({ status: 200, description: 'Restaurant found' })
|
@ApiResponse({ status: 200, description: 'Restaurant found' })
|
||||||
@ApiNotFoundResponse({ description: 'Restaurant not found' })
|
@ApiNotFoundResponse({ description: 'Restaurant not found' })
|
||||||
findOne(@Param('slug') slug: string) {
|
@Get('my-restaurant')
|
||||||
return this.restaurantsService.findBySlug(slug);
|
async findOne(@RestId() restId: string) {
|
||||||
|
return await this.restaurantsService.findOne(restId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
|
|||||||
@@ -38,6 +38,16 @@ export class RestaurantsService {
|
|||||||
return restaurant;
|
return restaurant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async findOne(id: string): Promise<Restaurant> {
|
||||||
|
const restaurant = await this.restRepository.findOne({ id });
|
||||||
|
|
||||||
|
if (!restaurant) {
|
||||||
|
throw new NotFoundException(RestMessage.NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
return restaurant;
|
||||||
|
}
|
||||||
|
|
||||||
async getRestaurantSpecification(slug: string): Promise<RestaurantSpecificationDto> {
|
async getRestaurantSpecification(slug: string): Promise<RestaurantSpecificationDto> {
|
||||||
const restaurant = await this.findBySlug(slug);
|
const restaurant = await this.findBySlug(slug);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user