From f07837cfdb990c78ec3c40ae524138a3c0bebd26 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Wed, 19 Nov 2025 01:00:07 +0330 Subject: [PATCH] up --- .../controllers/schedule.controller.ts | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/modules/restaurants/controllers/schedule.controller.ts b/src/modules/restaurants/controllers/schedule.controller.ts index 6b2959f..55dfeda 100644 --- a/src/modules/restaurants/controllers/schedule.controller.ts +++ b/src/modules/restaurants/controllers/schedule.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Post, Body, Patch, Param, Delete, Query, ValidationPipe, UseGuards } from '@nestjs/common'; +import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common'; import { ApiTags, ApiOperation, @@ -7,7 +7,7 @@ import { ApiNotFoundResponse, ApiParam, ApiBody, - ApiQuery, + ApiBearerAuth, } from '@nestjs/swagger'; import { ScheduleService } from '../providers/schedule.service'; import { CreateScheduleDto } from '../dto/create-schedule.dto'; @@ -16,52 +16,52 @@ import { Schedule } from '../entities/schedule.entity'; import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard'; import { RestId } from 'src/common/decorators/rest-id.decorator'; -@ApiTags('schedules') -@Controller('schedules') @UseGuards(AdminAuthGuard) +@ApiBearerAuth() +@ApiTags('admin/schedules') +@Controller('admin/schedules') export class ScheduleController { constructor(private readonly scheduleService: ScheduleService) {} @Post() - @ApiOperation({ summary: 'ایجاد برنامه جدید' }) + @ApiOperation({ summary: 'Create a new schedule' }) @ApiBody({ type: CreateScheduleDto }) - @ApiCreatedResponse({ description: 'برنامه ایجاد شد', type: Schedule }) + @ApiCreatedResponse({ description: 'Schedule created successfully', type: Schedule }) create(@Body() createScheduleDto: CreateScheduleDto, @RestId() restId: string) { return this.scheduleService.create(restId, createScheduleDto); } @Get() - @ApiOperation({ summary: 'لیست همه برنامه‌ها' }) - @ApiQuery({ name: 'restId', required: false, type: String, description: 'شناسه رستوران برای فیلتر کردن' }) - @ApiOkResponse({ description: 'لیست برنامه‌ها', type: [Schedule] }) + @ApiOperation({ summary: 'Get all schedules' }) + @ApiOkResponse({ description: 'List of schedules', type: [Schedule] }) findAll(@RestId() restId: string) { return this.scheduleService.findAll(restId); } @Get(':id') - @ApiOperation({ summary: 'دریافت یک برنامه' }) - @ApiParam({ name: 'id', description: 'شناسه برنامه' }) - @ApiOkResponse({ description: 'جزئیات برنامه', type: Schedule }) - @ApiNotFoundResponse({ description: 'برنامه یافت نشد' }) + @ApiOperation({ summary: 'Get a schedule by ID' }) + @ApiParam({ name: 'id', description: 'Schedule ID' }) + @ApiOkResponse({ description: 'Schedule details', type: Schedule }) + @ApiNotFoundResponse({ description: 'Schedule not found' }) findOne(@Param('id') id: string, @RestId() restId: string) { return this.scheduleService.findOne(id, restId); } @Patch(':id') - @ApiOperation({ summary: 'به‌روزرسانی برنامه' }) - @ApiParam({ name: 'id', description: 'شناسه برنامه' }) + @ApiOperation({ summary: 'Update a schedule' }) + @ApiParam({ name: 'id', description: 'Schedule ID' }) @ApiBody({ type: UpdateScheduleDto }) - @ApiOkResponse({ description: 'برنامه به‌روز شد', type: Schedule }) - @ApiNotFoundResponse({ description: 'برنامه یافت نشد' }) + @ApiOkResponse({ description: 'Schedule updated successfully', type: Schedule }) + @ApiNotFoundResponse({ description: 'Schedule not found' }) update(@Param('id') id: string, @Body() updateScheduleDto: UpdateScheduleDto, @RestId() restId: string) { return this.scheduleService.update(id, restId, updateScheduleDto); } @Delete(':id') - @ApiOperation({ summary: 'حذف برنامه' }) - @ApiParam({ name: 'id', description: 'شناسه برنامه' }) - @ApiOkResponse({ description: 'برنامه حذف شد' }) - @ApiNotFoundResponse({ description: 'برنامه یافت نشد' }) + @ApiOperation({ summary: 'Delete a schedule' }) + @ApiParam({ name: 'id', description: 'Schedule ID' }) + @ApiOkResponse({ description: 'Schedule deleted successfully' }) + @ApiNotFoundResponse({ description: 'Schedule not found' }) remove(@Param('id') id: string, @RestId() restId: string) { return this.scheduleService.remove(id, restId); }