update print controller

This commit is contained in:
2026-01-28 10:32:28 +03:30
parent c0ae827696
commit b90654250c
4 changed files with 12 additions and 23 deletions
@@ -1,15 +1,16 @@
import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common'; import { Controller, Get, Post, Body, Patch, Param, Delete, UseGuards } from '@nestjs/common';
import { SectionService } from '../provider/section.service'; import { SectionService } from '../provider/section.service';
import { CreateSectionDto } from '../dto/create-section.dto'; import { CreateSectionDto } from '../dto/create-section.dto';
import { UpdateSectionDto } from '../dto/update-section.dto';
import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger'; import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
import { AdminAuthGuard } from '../../auth/guards/adminAuth.guard'; import { AdminAuthGuard } from '../../auth/guards/adminAuth.guard';
import { FieldService } from '../provider/field.service'; import { FieldService } from '../provider/field.service';
import { CreateFieldDto } from '../dto/create-field.dto'; import { CreateFieldDto } from '../dto/create-field.dto';
import { CreateFieldOptionDto } from '../dto/create-field-option.dto'; import { CreateFieldOptionDto } from '../dto/create-field-option.dto';
import { FieldOptionService } from '../provider/field-option.service'; 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() @ApiBearerAuth()
export class PrintController { export class PrintController {
constructor( constructor(
@@ -49,7 +50,7 @@ import { FieldOptionService } from '../provider/field-option.service';
} }
@Delete('section/:id') @Delete('section/:id')
@ApiOperation({ summary: 'Renopve section' }) @ApiOperation({ summary: 'Remove section' })
@UseGuards(AdminAuthGuard) @UseGuards(AdminAuthGuard)
remove(@Param('id') id: string) { remove(@Param('id') id: string) {
return this.sectionService.remove(+id); return this.sectionService.remove(+id);
@@ -81,7 +82,7 @@ import { FieldOptionService } from '../provider/field-option.service';
@Patch('section/field/:id') @Patch('section/field/:id')
@ApiOperation({ summary: 'Update field' }) @ApiOperation({ summary: 'Update field' })
@UseGuards(AdminAuthGuard) @UseGuards(AdminAuthGuard)
updateField(@Param('id') id: string, @Body() dto: UpdateSectionDto) { updateField(@Param('id') id: string, @Body() dto: UpdateFieldDto) {
return this.fieldService.update(+id, dto); return this.fieldService.update(+id, dto);
} }
@@ -0,0 +1,4 @@
import { PartialType } from '@nestjs/swagger';
import { CreateFieldDto } from './create-field.dto';
export class UpdateFieldDto extends PartialType(CreateFieldDto) { }
@@ -1,4 +0,0 @@
import { PartialType } from '@nestjs/swagger';
import { CreateSectionDto } from './create-section.dto';
export class UpdatePrintDto extends PartialType(CreateSectionDto) { }
+3 -15
View File
@@ -1,16 +1,4 @@
import { IsString, IsOptional, IsBoolean, IsInt, Min, IsEnum, IsNotEmpty } from 'class-validator'; import { PartialType } from '@nestjs/swagger';
import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger'; import { CreateSectionDto } from './create-section.dto';
import { Type } from 'class-transformer';
export class UpdateSectionDto { export class UpdateSectionDto extends PartialType(CreateSectionDto) { }
@IsString()
@ApiProperty({ example: ' ' })
title: string;
@IsOptional()
@IsInt()
@Min(0)
@Type(() => Number)
@ApiPropertyOptional({ example: 1 })
order?: number;
}