diff --git a/src/modules/print/controller/print.controller.ts b/src/modules/print/controller/print.controller.ts index 3b007f8..a1cd104 100644 --- a/src/modules/print/controller/print.controller.ts +++ b/src/modules/print/controller/print.controller.ts @@ -1,15 +1,16 @@ import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common'; import { SectionService } from '../provider/section.service'; import { CreateSectionDto } from '../dto/create-section.dto'; -import { UpdateSectionDto } from '../dto/update-section.dto'; import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger'; import { AdminAuthGuard } from '../../auth/guards/adminAuth.guard'; import { FieldService } from '../provider/field.service'; import { CreateFieldDto } from '../dto/create-field.dto'; import { CreateFieldOptionDto } from '../dto/create-field-option.dto'; import { FieldOptionService } from '../provider/field-option.service'; +import { UpdateFieldDto } from '../dto/update-field.dto'; +import { UpdateSectionDto } from '../dto/update-section.dto'; -@Controller('admin/print') +@Controller('admin') @ApiBearerAuth() export class PrintController { constructor( @@ -49,7 +50,7 @@ import { FieldOptionService } from '../provider/field-option.service'; } @Delete('section/:id') - @ApiOperation({ summary: 'Renopve section' }) + @ApiOperation({ summary: 'Remove section' }) @UseGuards(AdminAuthGuard) remove(@Param('id') id: string) { return this.sectionService.remove(+id); @@ -81,7 +82,7 @@ import { FieldOptionService } from '../provider/field-option.service'; @Patch('section/field/:id') @ApiOperation({ summary: 'Update field' }) @UseGuards(AdminAuthGuard) - updateField(@Param('id') id: string, @Body() dto: UpdateSectionDto) { + updateField(@Param('id') id: string, @Body() dto: UpdateFieldDto) { return this.fieldService.update(+id, dto); } diff --git a/src/modules/print/dto/update-field.dto.ts b/src/modules/print/dto/update-field.dto.ts new file mode 100644 index 0000000..50520ee --- /dev/null +++ b/src/modules/print/dto/update-field.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from '@nestjs/swagger'; +import { CreateFieldDto } from './create-field.dto'; + +export class UpdateFieldDto extends PartialType(CreateFieldDto) { } diff --git a/src/modules/print/dto/update-print.dto.ts b/src/modules/print/dto/update-print.dto.ts deleted file mode 100644 index 2376d0b..0000000 --- a/src/modules/print/dto/update-print.dto.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { PartialType } from '@nestjs/swagger'; -import { CreateSectionDto } from './create-section.dto'; - -export class UpdatePrintDto extends PartialType(CreateSectionDto) { } diff --git a/src/modules/print/dto/update-section.dto.ts b/src/modules/print/dto/update-section.dto.ts index 08d16a6..69231b0 100644 --- a/src/modules/print/dto/update-section.dto.ts +++ b/src/modules/print/dto/update-section.dto.ts @@ -1,16 +1,4 @@ -import { IsString, IsOptional, IsBoolean, IsInt, Min, IsEnum, IsNotEmpty } from 'class-validator'; -import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger'; -import { Type } from 'class-transformer'; +import { PartialType } from '@nestjs/swagger'; +import { CreateSectionDto } from './create-section.dto'; -export class UpdateSectionDto { - @IsString() - @ApiProperty({ example: ' ' }) - title: string; - - @IsOptional() - @IsInt() - @Min(0) - @Type(() => Number) - @ApiPropertyOptional({ example: 1 }) - order?: number; -} +export class UpdateSectionDto extends PartialType(CreateSectionDto) { }