fix: issues related to PUT operations

This commit is contained in:
Ahmed Bouhuolia
2025-10-28 18:12:08 +02:00
parent 368c85a01a
commit f736c3f9eb
23 changed files with 48 additions and 37 deletions

View File

@@ -28,8 +28,9 @@ export class EditBillService {
private transformerDTO: BillDTOTransformer,
@Inject(Bill.name) private billModel: TenantModelProxy<typeof Bill>,
@Inject(Vendor.name) private contactModel: TenantModelProxy<typeof Vendor>,
) {}
@Inject(Vendor.name) private vendorModel: TenantModelProxy<typeof Vendor>,
) { }
/**
* Edits details of the given bill id with associated entries.
@@ -58,10 +59,9 @@ export class EditBillService {
this.validators.validateBillExistance(oldBill);
// Retrieve vendor details or throw not found service error.
const vendor = await this.contactModel()
const vendor = await this.vendorModel()
.query()
.findById(billDTO.vendorId)
.modify('vendor')
.throwIfNotFound();
// Validate bill number uniqiness on the storage.