Files
api-AT/src/programa_equipo/programa_equipo.controller.ts
T

54 lines
1.8 KiB
TypeScript
Raw Normal View History

2026-02-23 18:16:17 -06:00
import { Controller, Get, Body, Patch, Param, UseGuards } from '@nestjs/common';
import { ProgramaEquipoService } from './programa_equipo.service';
2026-01-28 19:05:51 -06:00
import { UpdateProgramaEquipoDto, UpdateProgramasSalaDto } from './dto/update-programa_equipo.dto';
2026-02-23 18:16:17 -06:00
import { JwtAuthGuard } from 'src/user/jwt.guard';
2026-03-02 14:49:15 -06:00
import { RolesGuard } from 'src/roles.guard';
import { Roles } from 'src/roles.decorator';
import { Role } from 'src/role.enum';
@Controller('programa-equipo')
export class ProgramaEquipoController {
2026-03-02 14:49:15 -06:00
constructor(private readonly programaEquipoService: ProgramaEquipoService) { }
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2025-10-08 15:45:21 -06:00
@Get('programas/:id')
async findAllProgramByNumber(@Param('id') id: number) {
return await this.programaEquipoService.findAllProgramByNumber(+id);
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2026-01-28 19:05:51 -06:00
@Get('ubicacion/:id')
findAllProgramByUbicacion(@Param('id') id: string) {
return this.programaEquipoService.findAllProgramByUbication(id);
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get(':id')
findOne(@Param('id') id: number) {
2026-01-27 18:33:43 -06:00
return this.programaEquipoService.findOne(id);
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2026-01-28 19:05:51 -06:00
@Patch('equipo/:id')
updateMachine(
2025-10-08 15:45:21 -06:00
@Param('id') id: string,
@Body() updateProgramaEquipoDto: UpdateProgramaEquipoDto,
) {
2026-01-28 19:05:51 -06:00
return this.programaEquipoService.updateMachine(
Number(id),
updateProgramaEquipoDto.programas,
);
}
2026-03-02 14:49:15 -06:00
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
2026-01-28 19:05:51 -06:00
@Patch('sala')
updateBySala(@Body() dto: UpdateProgramasSalaDto) {
return this.programaEquipoService.updateBySala(dto.sala, dto.programas);
}
}