Enhance proforma creation and update processes by verifying saved data integrity
This commit is contained in:
parent
cb7a60e593
commit
e7a6fb0242
@ -76,7 +76,14 @@ export class ProformaCreator implements IProformaCreator {
|
||||
return Result.fail(saveResult.error);
|
||||
}
|
||||
|
||||
return Result.ok(proforma);
|
||||
// 4. Verificar creación
|
||||
const verifyResult = await this.deps.repository.getByIdInCompany(companyId, id, transaction);
|
||||
|
||||
if (verifyResult.isFailure) {
|
||||
return Result.fail(verifyResult.error);
|
||||
}
|
||||
|
||||
return Result.ok(verifyResult.data);
|
||||
}
|
||||
|
||||
private async resolveCreateProps(
|
||||
|
||||
@ -67,7 +67,14 @@ export class ProformaUpdater implements IProformaUpdater {
|
||||
return Result.fail(saveResult.error);
|
||||
}
|
||||
|
||||
return Result.ok(proforma);
|
||||
// Volvemos a recuperar lo guardado para asegurarnos de que los cambios se reflejen correctamente
|
||||
const verifyResult = await this.deps.repository.getByIdInCompany(companyId, id, transaction);
|
||||
|
||||
if (verifyResult.isFailure) {
|
||||
return Result.fail(verifyResult.error);
|
||||
}
|
||||
|
||||
return Result.ok(verifyResult.data);
|
||||
}
|
||||
|
||||
private async resolvePatchProps(params: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user