added all roles

This commit is contained in:
2026-03-02 14:49:15 -06:00
parent 8aa0eab353
commit 0323c93ca3
22 changed files with 233 additions and 92 deletions
@@ -2,30 +2,38 @@ import { Controller, Get, Body, Patch, Param, UseGuards } from '@nestjs/common';
import { ProgramaEquipoService } from './programa_equipo.service';
import { UpdateProgramaEquipoDto, UpdateProgramasSalaDto } from './dto/update-programa_equipo.dto';
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('programa-equipo')
export class ProgramaEquipoController {
constructor(private readonly programaEquipoService: ProgramaEquipoService) {}
constructor(private readonly programaEquipoService: ProgramaEquipoService) { }
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get('programas/:id')
findAllProgramByNumber(@Param('id') id: number) {
return this.programaEquipoService.findAllProgramByNumber(+id);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get('ubicacion/:id')
findAllProgramByUbicacion(@Param('id') id: string) {
return this.programaEquipoService.findAllProgramByUbication(id);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get(':id')
findOne(@Param('id') id: string) {
return this.programaEquipoService.findOne(id);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Patch('equipo/:id')
updateMachine(
@Param('id') id: string,
@@ -37,7 +45,8 @@ export class ProgramaEquipoController {
);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Patch('sala')
updateBySala(@Body() dto: UpdateProgramasSalaDto) {
return this.programaEquipoService.updateBySala(dto.sala, dto.programas);