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 {