Files
api-AT/src/area_ubicacion/area_ubicacion.controller.ts
T
2026-03-02 14:49:15 -06:00

34 lines
1.1 KiB
TypeScript

import { Controller, Get, Param, UseGuards } from '@nestjs/common';
import { AreaUbicacionService } from './area_ubicacion.service';
import { JwtAuthGuard } from 'src/user/jwt.guard';
import { RolesGuard } from 'src/roles.guard';
import { Roles } from 'src/roles.decorator';
import { Role } from 'src/role.enum';
@Controller('area-ubicacion')
export class AreaUbicacionController {
constructor(private readonly areaUbicacionService: AreaUbicacionService) { }
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Get()
findAll() {
return this.areaUbicacionService.findAll();
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get(':id')
findOne(@Param('id') id: string) {
return this.areaUbicacionService.findOne(+id);
}
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get('/programs/:id')
findProgramsByArea(@Param('id') id: number) {
return this.areaUbicacionService.findProgramsByArea(+id)
}
}
//IO