update print controller
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) { }
|
||||
@@ -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) { }
|
||||
|
||||
Reference in New Issue
Block a user