src/services/services.controller.ts
service
Methods |
deleteService | ||||||
deleteService(params: IsParameterWithIdOfTable)
|
||||||
Decorators :
@Delete(':id')
|
||||||
Defined in src/services/services.controller.ts:50
|
||||||
Parameters :
Returns :
any
|
getBlogByIdOrSlug | ||||
getBlogByIdOrSlug(params)
|
||||
Decorators :
@Public()
|
||||
Defined in src/services/services.controller.ts:58
|
||||
Parameters :
Returns :
any
|
getService |
getService()
|
Decorators :
@Public()
|
Defined in src/services/services.controller.ts:18
|
Returns :
any
|
saveService | ||||||
saveService(modelService: ServiceValidation)
|
||||||
Decorators :
@UseInterceptors(undefined)
|
||||||
Defined in src/services/services.controller.ts:25
|
||||||
Parameters :
Returns :
any
|
updateService | |||||||||
updateService(modelService: ServiceValidation, params)
|
|||||||||
Decorators :
@UseInterceptors(undefined)
|
|||||||||
Defined in src/services/services.controller.ts:38
|
|||||||||
Parameters :
Returns :
any
|
import { Body, Controller, Get, Param, Post, Put, UseInterceptors,Delete } from '@nestjs/common';
import { ServicesService } from './services.service';
import { FileInterceptor } from '@nestjs/platform-express';
import { ServiceValidation } from 'src/database/validation/service-validation';
import { IsParameterWithIdOfTable } from 'src/database/validation/parameter-validation';
import { Public } from 'src/auth/auth.controller';
import { ExceptionErrorMessage } from 'src/validation/exception-error';
import { SkipThrottle } from '@nestjs/throttler';
@SkipThrottle()
@Controller('service')
export class ServicesController {
constructor(private serviceService:ServicesService){}
//Exponer punto para el listado de todos los Servicios
@Public()
@Get()
getService():any{
return this.serviceService.findAllServices();
}
//Exponer punto para almacenamiento de un nuevo servicio
@UseInterceptors(FileInterceptor(''))
@Post()
saveService(@Body() modelService:ServiceValidation):any{
try {
const customer = modelService.customer;
delete modelService.customer;
return this.serviceService.saveService(modelService,customer);
} catch (error) {
ExceptionErrorMessage(error);
}
}
//Exponer punto para actualizar un servicio mediante su id
@UseInterceptors(FileInterceptor(''))
@Put(':id')
updateService(@Body() modelService:ServiceValidation, @Param() params):any{
try {
const customer = modelService.customer;
delete modelService.customer;
return this.serviceService.updateService(params.id, modelService, customer);
} catch (error) {
ExceptionErrorMessage(error);
}
}
//Exponer punto para remover un servicio mediante su id
@Delete(':id')
deleteService(@Param() params:IsParameterWithIdOfTable){
return this.serviceService.deleteService(params.id);
}
//Exponer punto para obtener un servicio mediante su slug
@Public()
@Get('search/:slug')
getBlogByIdOrSlug(@Param() params):any{
return this.serviceService.findlBySlug(params.slug);
}
}