This commit is contained in:
2025-09-24 11:34:50 -06:00
16 changed files with 225 additions and 20 deletions
+11 -1
View File
@@ -1,6 +1,6 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { Response } from 'express';
import { CreateUserDto, Login } from './dto/create-user.dto';
import { changePasswordDto, CreateUserDto, Login } from './dto/create-user.dto';
import { InjectRepository } from '@nestjs/typeorm';
import { Perfil, User } from './entities/user.entity';
import { Repository } from 'typeorm';
@@ -76,5 +76,15 @@ export class UserService {
const user = this.userRepository.create(datauser);
return this.userRepository.save(user);
}
async changePassword(data: changePasswordDto, id_usuario: number) {
const user = await this.findOneByNameandPassword({
usuario: (await this.findOne(id_usuario)).usuario,
password: data.password,
});
user.password = data.newPassword;
return this.userRepository.save(user);
}
}
//IO