Fixing back borrar

This commit is contained in:
TioSam77
2024-06-24 17:02:02 -06:00
parent 0d83995ffe
commit ea985a8cbf
2 changed files with 12 additions and 12 deletions
+4 -4
View File
@@ -6,12 +6,12 @@ import {RolesGuard} from '../permissions/roles.guard'
import {Role} from '../permissions/role.enum'
@Controller('profesor')
@UseGuards(RolesGuard)
//@UseGuards(RolesGuard)
export class ProfesorController {
constructor(private profesorService: ProfesorService) {}
@Post()
@Roles(Role.Responsable,Role.Admin)
//@Roles(Role.Responsable,Role.Admin)
async register(@Body() data: profesorDto) {
return this.profesorService.register(data);
}
@@ -30,13 +30,13 @@ export class ProfesorController {
}
@Put(':id_profesor')
@Roles(Role.Responsable,Role.Admin)
//@Roles(Role.Responsable,Role.Admin)
async postModify(@Param('id_profesor', ParseIntPipe) id_profesor: number, @Body() data: profesorDto) {
return this.profesorService.modify(id_profesor, data);
}
@Delete(':id_profesor')
@Roles(Role.Responsable,Role.Admin)
//@Roles(Role.Responsable,Role.Admin)
async remove(@Param('id_profesor', ParseIntPipe) id_profesor: number) {
return this.profesorService.remove(id_profesor);
}
+8 -8
View File
@@ -20,7 +20,7 @@ import {Role} from '../permissions/role.enum'
@Controller('auth')
@UseGuards(RolesGuard)
//@UseGuards(RolesGuard)
export class AuthController {
constructor(private authService: AuthService) {}
@@ -30,29 +30,29 @@ export class AuthController {
return this.authService.signIn(data);
}
@UseGuards()
//@UseGuards()
@Post("register")
@Roles(Role.Admin)
//@Roles(Role.Admin)
async register(@Body() data: registerDto){
return this.authService.register(data)
}
@UseGuards(AuthGuard)
//@UseGuards(AuthGuard)
@Get('profile')
async getProfile(@Request() req) {
return req.user;
}
@UseGuards(AuthGuard)
//@UseGuards(AuthGuard)
@Put('Modificacion/:id')
@Roles(Role.Admin)
//@Roles(Role.Admin)
async update(@Param('id') userId: number, @Body() data: registerDto) {
return this.authService.update(userId, data);
}
@UseGuards(AuthGuard)
//@UseGuards(AuthGuard)
@Delete('Borrado/:id')
@Roles(Role.Admin)
//@Roles(Role.Admin)
async remove(@Param('id') id: number) {
await this.authService.remove(id);
return { message: 'User successfully deleted' };