fix: make unique number of sales and purchases transactions is optional.

This commit is contained in:
Ahmed Bouhuolia
2020-10-26 14:32:35 +02:00
parent 3446dba0c5
commit 4ed96e5143
6 changed files with 42 additions and 20 deletions

View File

@@ -99,8 +99,9 @@ export default class SaleEstimateService {
};
// Validate estimate number uniquiness on the storage.
await this.validateEstimateNumberExistance(tenantId, estimateDTO.estimateNumber);
if (estimateDTO.estimateNumber) {
await this.validateEstimateNumberExistance(tenantId, estimateDTO.estimateNumber);
}
// Retrieve the given customer or throw not found service error.
await this.customersService.getCustomer(tenantId, estimateDTO.customerId);
@@ -146,8 +147,9 @@ export default class SaleEstimateService {
};
// Validate estimate number uniquiness on the storage.
await this.validateEstimateNumberExistance(tenantId, estimateDTO.estimateNumber, estimateId);
if (estimateDTO.estimateNumber) {
await this.validateEstimateNumberExistance(tenantId, estimateDTO.estimateNumber, estimateId);
}
// Retrieve the given customer or throw not found service error.
await this.customersService.getCustomer(tenantId, estimateDTO.customerId);