get restaurant by subscription id
This commit is contained in:
@@ -80,5 +80,14 @@ export class RestaurantsController {
|
|||||||
return this.restaurantsService.create(createRestaurantDto);
|
return this.restaurantsService.create(createRestaurantDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UseGuards(SuperAdminAuthGuard)
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@ApiOperation({ summary: 'Get restaurant by subscription ID' })
|
||||||
|
@ApiParam({ name: 'subscriptionId', required: true, description: 'Subscription ID' })
|
||||||
|
@Get('super-admin/restaurants/subscription/:subscriptionId')
|
||||||
|
findOneBySubscriptionId(@Param('subscriptionId') subscriptionId: string) {
|
||||||
|
return this.restaurantsService.findOneBySubscriptionId(subscriptionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ export class RestaurantsService {
|
|||||||
return restaurant;
|
return restaurant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async findOneBySubscriptionId(subscriptionId: string): Promise<Restaurant> {
|
||||||
|
const restaurant = await this.restRepository.findOne({ subscriptionId });
|
||||||
|
if (!restaurant) {
|
||||||
|
throw new NotFoundException(RestMessage.NOT_FOUND);
|
||||||
|
}
|
||||||
|
return restaurant;
|
||||||
|
}
|
||||||
|
|
||||||
async getRestaurantSpecification(slug: string) {
|
async getRestaurantSpecification(slug: string) {
|
||||||
const restaurant = await this.findBySlug(slug);
|
const restaurant = await this.findBySlug(slug);
|
||||||
return restaurant;
|
return restaurant;
|
||||||
|
|||||||
Reference in New Issue
Block a user