listo para pruebas passcode

This commit is contained in:
2022-11-03 11:37:49 -06:00
parent 2b5f226ffe
commit af0602b7df
4 changed files with 40 additions and 24 deletions
+12 -21
View File
@@ -21,18 +21,18 @@ export class PasscodeService {
) {}
crearPasscode(prestamo: Prestamo) {
const aux = {
1: '00000',
2: '0000',
3: '000',
4: '00',
5: '0',
6: '',
};
return this.repository
.save(this.repository.create({ prestamo }))
.then((passcodeInterno) => {
const aux = {
1: '00000',
2: '0000',
3: '000',
4: '00',
5: '0',
6: '',
};
passcodeInterno.passcode = `${prestamo.equipo.carrito.id_carrito}${
aux[passcodeInterno.id_passcode.toString().length]
}${passcodeInterno.id_passcode}${Math.floor(
@@ -101,16 +101,7 @@ export class PasscodeService {
});
}
// findPasscode(id_prestamo: number) {
// return this.repository
// .findOne({ where: { prestamo: { id_prestamo } } })
// .then(async (passcode) => {
// if (!passcode)
// throw new BadRequestException({
// message: `Este passcode no existe`,
// code: 6,
// });
// return passcode.passcode;
// });
// }
findByPrestamo(prestamo: Prestamo) {
return this.repository.findOne({ where: { prestamo } });
}
}