From 61ea72111fd1da8dbb5b444719bfc43b2132f6c5 Mon Sep 17 00:00:00 2001 From: TioSam77 Date: Tue, 18 Jun 2024 19:34:55 -0600 Subject: [PATCH] S12 --- src/auth/auth.controller.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 615b854..cb6a9f1 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -14,6 +14,7 @@ import { import { AuthGuard } from './auth.guard'; import { AuthService } from './auth.service'; import { registerDto } from './dto/registerDto.dto'; +import { UserDto } from 'src/users/dto/userDto.dto'; @Controller('auth') export class AuthController { @@ -36,14 +37,16 @@ export class AuthController { return req.user; } + @UseGuards(AuthGuard) @Put('Modificacion/:id') - async update(@Param('id') userId: number, @Body() updateUserDto: Record) { - return this.authService.update(userId, updateUserDto); + async update(@Param('id') id: number, @Body() updateUserDto: Record) { + return this.authService.update(id, updateUserDto); } - @Delete(':id') - async remove(@Param('id') userId: number) { - await this.authService.remove(userId); + @UseGuards(AuthGuard) + @Delete('Borrado/:id') + async remove(@Param('id') id: number) { + await this.authService.remove(id); return { message: 'User successfully deleted' }; }