src/category/category.controller.ts
category
Methods |
deleteCategory | ||||||
deleteCategory(params: IsParameterWithIdOfTable)
|
||||||
Decorators :
@Delete(':id')
|
||||||
Defined in src/category/category.controller.ts:46
|
||||||
Parameters :
Returns :
any
|
getCategory |
getCategory()
|
Decorators :
@Get()
|
Defined in src/category/category.controller.ts:25
|
Returns :
any
|
getCategoryPublic |
getCategoryPublic()
|
Decorators :
@Public()
|
Defined in src/category/category.controller.ts:19
|
Returns :
any
|
saveCategory | ||||||
saveCategory(modelCategory: CategoryValidation)
|
||||||
Decorators :
@UseInterceptors(undefined)
|
||||||
Defined in src/category/category.controller.ts:32
|
||||||
Parameters :
Returns :
any
|
updateCategory | |||||||||
updateCategory(modelCategory: CategoryValidation, params)
|
|||||||||
Decorators :
@UseInterceptors(undefined)
|
|||||||||
Defined in src/category/category.controller.ts:40
|
|||||||||
Parameters :
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);
}
}