From 215c9f6ce574154047e08e377c0c3a6c0716c62a Mon Sep 17 00:00:00 2001 From: IO <320154041@pcpuma.acatlan.unam.mx> Date: Wed, 19 Jun 2024 12:49:28 -0600 Subject: [PATCH] =?UTF-8?q?i=20don=C2=B4t=20know=20what=20i=20do?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/auth.controller.ts | 4 ++-- src/auth/auth.service.ts | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 86fe81d..1ec9d93 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -37,8 +37,8 @@ export class AuthController { } @Put('Modificacion/:id') - async update(@Param('id') userId: number, @Body() updateUserDto: Record) { - return this.authService.update(userId, updateUserDto); + async update(@Param('id') userId: number, @Body() data: registerDto) { + return this.authService.update(userId, data); } @Delete(':id') diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 6a2e42c..5b88f77 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -65,16 +65,17 @@ export class AuthService { return { token: token }; } - async update(userId, updateUserDto) { + //update user + async update(userId, data:registerDto) { - const{contraseña}=updateUserDto; + const{contraseña}=data; if(contraseña){ const hashedpassword = await hash(contraseña, 10); - updateUserDto = {...updateUserDto,contraseña:hashedpassword}; + data = {...data,contraseña:hashedpassword}; } - return await this.userRepository.update(userId, updateUserDto); + return await this.userRepository.update(userId, data); } async remove(userId: number): Promise {