create simpel login
This commit is contained in:
@@ -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);
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user