create simpel login

This commit is contained in:
TheManus88
2024-09-11 22:35:57 -06:00
parent 6c59c341e7
commit ca79113b62
14 changed files with 373 additions and 14 deletions
+37 -1
View File
@@ -1,7 +1,43 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { UsuarioEntity } from '../entities/usuario.entity';
import { Repository } from 'typeorm';
import { LoginDTO } from '../dtos/loginDTO';
export type User = any;
@Injectable()
export class UsersService {
constructor(
@InjectRepository(UsuarioEntity)
private usersRepository: Repository<UsuarioEntity>,
) {}
// findAll(): Promise<UsuarioEntity[]> {
// return this.usersRepository.find();
// }
findStudent(loginDto: LoginDTO): Promise<UsuarioEntity | null> {
const numero_identificacion = loginDto.numero_identificacion;
const fecha_nacimiento = loginDto.fecha_nacimiento;
return this.usersRepository.findOneBy({
numero_identificacion,
fecha_nacimiento,
});
}
findWorker(loginDto: LoginDTO): Promise<UsuarioEntity | null> {
const numero_identificacion = loginDto.numero_identificacion;
const rfc = loginDto.rfc;
return this.usersRepository.findOneBy({
numero_identificacion,
rfc,
});
}
// findOne(id: number): Promise<UsuarioEntity | null> {
// return this.usersRepository.findOneBy({ id });
// }
//
// async remove(id: number): Promise<void> {
// await this.usersRepository.delete(id);
// }
}