added all roles
This commit is contained in:
@@ -3,66 +3,79 @@ import { EquipoService } from './equipo.service';
|
||||
import { Equipo } from './entities/equipo.entity';
|
||||
import { CreateEquipoDto, UpdateAreaEquiposDto } from './dto/create-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('equipo')
|
||||
export class EquipoController {
|
||||
constructor(private readonly equipoService: EquipoService) { }
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Get()
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR, Role.ATENCION_USUARIOS, Role.SERVICIO_SOCIAL)
|
||||
findAll(): Promise<Equipo[]> {
|
||||
return this.equipoService.findAll();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
|
||||
@Get('/active')
|
||||
findActive() {
|
||||
return this.equipoService.findActive();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
@Get('/disable')
|
||||
findDisable() {
|
||||
return this.equipoService.findDisable();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
|
||||
@Get('/student/:id')
|
||||
findOnlyUsable(@Param('id') id: number): Promise<Equipo[]> {
|
||||
return this.equipoService.findOnlyUsable(+id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
@Get('/busy')
|
||||
findOnlyBusy(): Promise<Equipo[]> {
|
||||
return this.equipoService.findOnlyBusy();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string): Promise<Equipo> {
|
||||
return this.equipoService.findOne(id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
@Post()
|
||||
create(@Body() equipo: CreateEquipoDto) {
|
||||
return this.equipoService.create(equipo);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR)
|
||||
@Patch()
|
||||
update(@Body() equipo: CreateEquipoDto) {
|
||||
return this.equipoService.update(equipo);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR, Role.ATENCION_USUARIOS, Role.SERVICIO_SOCIAL)
|
||||
@Patch(':id/activo')
|
||||
toggleActivo(@Param('id') id: number) {
|
||||
return this.equipoService.toggleActivo(+id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@Roles(Role.ADMINISTRADOR, Role.SUPER_ADMINISTRADOR,Role.ATENCION_USUARIOS,Role.SERVICIO_SOCIAL)
|
||||
@Patch('actualizar-area')
|
||||
actualizarPorArea(
|
||||
@Body() updateAreaEquiposDto: UpdateAreaEquiposDto,
|
||||
|
||||
Reference in New Issue
Block a user