todo aparentemente listo
This commit is contained in:
@@ -20,7 +20,7 @@ export class PasscodeService {
|
||||
private prestamoService: PrestamoService,
|
||||
) {}
|
||||
|
||||
crearPasscode(prestamo: Prestamo) {
|
||||
create(prestamo: Prestamo) {
|
||||
return this.repository
|
||||
.save(this.repository.create({ prestamo }))
|
||||
.then((passcodeInterno) => {
|
||||
@@ -33,7 +33,7 @@ export class PasscodeService {
|
||||
6: '',
|
||||
};
|
||||
|
||||
passcodeInterno.passcode = `${prestamo.equipo.carrito.id_carrito}${
|
||||
passcodeInterno.passcode = `0${prestamo.equipo.carrito.id_carrito}${
|
||||
aux[passcodeInterno.id_passcode.toString().length]
|
||||
}${passcodeInterno.id_passcode}${Math.floor(
|
||||
Math.random() * 99999 + 10000,
|
||||
|
||||
@@ -51,8 +51,6 @@ export class PrestamoService {
|
||||
private fullInformacionPrestamoView: Repository<FullInformacionPrestamoView>,
|
||||
@InjectRepository(PrestamoInformacionView)
|
||||
private prestamoInformacionView: Repository<PrestamoInformacionView>,
|
||||
@Inject(forwardRef(() => PasscodeService))
|
||||
private passcodeService: PasscodeService,
|
||||
private appGateway: AppGateway,
|
||||
private equipoService: EquipoService,
|
||||
private institucionService: InstitucionService,
|
||||
@@ -65,6 +63,8 @@ export class PrestamoService {
|
||||
@Inject(forwardRef(() => MultaService))
|
||||
private multaService: MultaService,
|
||||
private operadorService: OperadorService,
|
||||
@Inject(forwardRef(() => PasscodeService))
|
||||
private passcodeService: PasscodeService,
|
||||
private tipoUsuarioService: TipoUsuarioService,
|
||||
private usuarioService: UsuarioService,
|
||||
) {}
|
||||
@@ -244,7 +244,14 @@ export class PrestamoService {
|
||||
.then((prestamo) => {
|
||||
// Actualizo la interfaz del operador
|
||||
this.appGateway.actualizarOperador(modulo.institucion.id_institucion);
|
||||
return this.prestamoPasscode(prestamo);
|
||||
if (
|
||||
prestamo.equipo.carrito.tipoCarrito.id_tipo_carrito === 4 ||
|
||||
prestamo.equipo.carrito.tipoCarrito.id_tipo_carrito === 5
|
||||
)
|
||||
return this.passcodeService
|
||||
.create(prestamo)
|
||||
.then((passcode) => ({ ...prestamo, passcode: passcode.passcode }));
|
||||
return prestamo;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user