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
+17 -7
View File
@@ -2,30 +2,37 @@ import { Controller, Get, Post, Body, Param, Patch, UseGuards } from '@nestjs/co
import { BitacoraService } from './bitacora.service';
import { BitacoraAlumnoDto, CreateBitacoraDto, EquiposPorEquipoDto } from './dto/create-bitacora.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('bitacora')
export class BitacoraController {
constructor(private readonly bitacoraService: BitacoraService) { }
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Post()
assignment(@Body() createBitacoraDto: CreateBitacoraDto) {
return this.bitacoraService.assignment(createBitacoraDto);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Get('/cuenta/:id')
findOneByAcount(@Param('id') id: string) {
return this.bitacoraService.findOneByAcount(+id);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Get('/equipo/:id')
findOneByMachine(@Param('id') id: string) {
return this.bitacoraService.findOneByMachine(+id);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
@Patch('cancelar/:id')
cancelationByMachine(
@Param('id') id: number,
@@ -34,13 +41,15 @@ export class BitacoraController {
return this.bitacoraService.cancelation(id, tiempo_asignado);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Get()
findAll() {
return this.bitacoraService.findAll();
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Post('equipos-por-dia')
async obtenerEquipos(
@Body() dto: BitacoraAlumnoDto
@@ -51,7 +60,8 @@ export class BitacoraController {
);
}
@UseGuards(JwtAuthGuard)
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
@Post('equipos-por-equipo')
async equiposPorEquipo(
@Body() dto: EquiposPorEquipoDto,