44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
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';
|
|
|
|
@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);
|
|
// }
|
|
}
|