File

src/category/category.controller.ts

Prefix

category

Index

Methods

Methods

deleteCategory
deleteCategory(params: IsParameterWithIdOfTable)
Decorators :
@Delete(':id')
Parameters :
Name Type Optional
params IsParameterWithIdOfTable No
Returns : any
getCategory
getCategory()
Decorators :
@Get()
Returns : any
getCategoryPublic
getCategoryPublic()
Decorators :
@Public()
@Get('list')
Returns : any
saveCategory
saveCategory(modelCategory: CategoryValidation)
Decorators :
@UseInterceptors(undefined)
@Post()
Parameters :
Name Type Optional
modelCategory CategoryValidation No
Returns : any
updateCategory
updateCategory(modelCategory: CategoryValidation, params)
Decorators :
@UseInterceptors(undefined)
@Put(':id')
Parameters :
Name Type Optional
modelCategory CategoryValidation No
params No
Returns : any
import { Body, Controller, Get, Param, Post, Put, UseInterceptors, Delete } from '@nestjs/common';
import { CategoryService } from './category.service';
import { FileInterceptor } from '@nestjs/platform-express';
import { CategoryModel } from 'src/database/interface/category-model/category-model.interface';
import { CategoryValidation } from 'src/database/validation/category-validation';
import { IsParameterWithIdOfTable } from 'src/database/validation/parameter-validation';
import { Public } from 'src/auth/auth.controller';
import { SkipThrottle } from '@nestjs/throttler';


@SkipThrottle()
@Controller('category')
export class CategoryController {
    constructor(private categoryService:CategoryService){}

    //Exponer punto para el listado de todas las categorias
    @Public()
    @Get('list')
    getCategoryPublic():any{
        return this.categoryService.findAllCategorysActive();
    }
    
    //Exponer punto para el listado de todas las categorias
    @Get()
    getCategory():any{
        return this.categoryService.findAllCategorys();
    }

    //Exponer punto para almacenamiento de una nueva categoria  
    @UseInterceptors(FileInterceptor(''))
    @Post()
    saveCategory(@Body() modelCategory:CategoryValidation):any{
        return this.categoryService.saveCategory(modelCategory);
    }

    //Exponer punto para actualizar una categoria mediante su id    
    //@Public()
    @UseInterceptors(FileInterceptor(''))
    @Put(':id')
    updateCategory(@Body() modelCategory:CategoryValidation, @Param() params):any{
        return this.categoryService.updateCategory(params.id, modelCategory);
    }

    //Exponer punto para remover una categoria mediante su id    
    @Delete(':id')
    deleteCategory(@Param() params:IsParameterWithIdOfTable){
      return this.categoryService.deleteCategory(params.id);
    }
  


}




results matching ""

    No results matching ""