added guard jwt
This commit is contained in:
@@ -1,57 +1,68 @@
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
|
||||
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';
|
||||
|
||||
@Controller('equipo')
|
||||
export class EquipoController {
|
||||
constructor(private readonly equipoService: EquipoService) { }
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
findAll(): Promise<Equipo[]> {
|
||||
return this.equipoService.findAll();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('/active')
|
||||
findActive() {
|
||||
return this.equipoService.findActive();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('/disable')
|
||||
findDisable() {
|
||||
return this.equipoService.findDisable();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('/student/:id')
|
||||
findOnlyUsable(@Param('id') id: number): Promise<Equipo[]> {
|
||||
return this.equipoService.findOnlyUsable(+id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('/busy')
|
||||
findOnlyBusy(): Promise<Equipo[]> {
|
||||
return this.equipoService.findOnlyBusy();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: string): Promise<Equipo> {
|
||||
return this.equipoService.findOne(id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Post()
|
||||
create(@Body() equipo: CreateEquipoDto) {
|
||||
return this.equipoService.create(equipo);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Patch()
|
||||
update(@Body() equipo: CreateEquipoDto) {
|
||||
return this.equipoService.update(equipo);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Patch(':id/activo')
|
||||
toggleActivo(@Param('id') id: number) {
|
||||
return this.equipoService.toggleActivo(+id);
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Patch('actualizar-area')
|
||||
actualizarPorArea(
|
||||
@Body() updateAreaEquiposDto: UpdateAreaEquiposDto,
|
||||
|
||||
Reference in New Issue
Block a user