listo para pruebas passcode
This commit is contained in:
@@ -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 } });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user