| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common'
- import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'
- import { FormService } from './form.service'
- import { PageRequest } from 'src/common/dto/page-request'
- import { Form } from './entities/form.entity'
- import { FormDto } from './dto/form.dto'
- import { Field } from './entities/filed.entity'
- @ApiTags('form')
- @ApiBearerAuth()
- @Controller('/form')
- export class FormController {
- constructor(private readonly formService: FormService) {}
- @Post()
- public async list(@Body() page: PageRequest<Form>) {
- return await this.formService.findAll(page)
- }
- @Put()
- public async create(@Body() form: Partial<Form>) {
- return await this.formService.save(form)
- }
- @Put('/:id')
- public async update(@Body() form: Partial<Form>) {
- return await this.formService.update(form)
- }
- @Post('/fileds')
- public async findAllFileds(@Body() page: PageRequest<Field>) {
- return await this.formService.findAllFileds(page)
- }
- @Delete('/:id')
- public async delete(@Param('id') id: string) {
- return await this.formService.delete(Number(id))
- }
- }
|