diff --git a/src/modules/restaurants/controllers/restaurants.controller.ts b/src/modules/restaurants/controllers/restaurants.controller.ts index 1e99ce1..43cf0fc 100644 --- a/src/modules/restaurants/controllers/restaurants.controller.ts +++ b/src/modules/restaurants/controllers/restaurants.controller.ts @@ -4,6 +4,7 @@ import { CreateRestaurantDto } from '../dto/create-restaurant.dto'; import { UpdateRestaurantDto } from '../dto/update-restaurant.dto'; import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard'; import { ApiBearerAuth, ApiBody, ApiNotFoundResponse, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; +import { RestId } from 'src/common/decorators'; @UseGuards(AdminAuthGuard) @ApiBearerAuth() @@ -48,6 +49,17 @@ export class RestaurantsController { update(@Param('id') id: string, @Body() updateRestaurantDto: UpdateRestaurantDto) { return this.restaurantsService.update(id, updateRestaurantDto); } + + @ApiBearerAuth() + @ApiOperation({ summary: 'Update a restaurant' }) + @ApiBody({ type: UpdateRestaurantDto }) + @ApiResponse({ status: 200, description: 'Restaurant updated' }) + @ApiNotFoundResponse({ type: NotFoundException, description: 'Restaurant not found' }) + @Patch('my-restaurant') + updateMyRestaurant(@RestId() restId: string, @Body() updateRestaurantDto: UpdateRestaurantDto) { + return this.restaurantsService.update(restId, updateRestaurantDto); + } + @ApiBearerAuth() @ApiOperation({ summary: 'Delete a restaurant' }) @ApiResponse({ status: 200, description: 'Restaurant deleted' }) diff --git a/src/modules/restaurants/dto/create-restaurant.dto.ts b/src/modules/restaurants/dto/create-restaurant.dto.ts index 8a8ab33..02cbad1 100644 --- a/src/modules/restaurants/dto/create-restaurant.dto.ts +++ b/src/modules/restaurants/dto/create-restaurant.dto.ts @@ -6,7 +6,7 @@ export class CreateRestaurantDto { @IsString() name!: string; - @ApiProperty({ example: 'cafe-zhivan', description: 'شناسه (slug) رستوران، لاتین و بدون فاصله' }) + @ApiProperty({ example: 'zhivan', description: 'شناسه (slug) رستوران، لاتین و بدون فاصله' }) @IsString() slug!: string;