fix: convert sale estimate to invoice.

This commit is contained in:
a.bouhuolia
2021-02-28 15:26:23 +02:00
parent fb9d68c2cf
commit 4d751f772e
6 changed files with 47 additions and 12 deletions

View File

@@ -7,7 +7,6 @@ import asyncMiddleware from 'api/middleware/asyncMiddleware';
import SaleEstimateService from 'services/Sales/SalesEstimate';
import DynamicListingService from 'services/DynamicListing/DynamicListService';
import { ServiceError } from "exceptions";
import { Request } from 'express-validator/src/base';
@Service()
export default class SalesEstimatesController extends BaseController {

View File

@@ -400,6 +400,20 @@ export default class SaleInvoicesController extends BaseController {
],
});
}
if (error.errorType === 'SALE_ESTIMATE_NOT_FOUND') {
return res.boom.badRequest(null, {
errors: [
{ type: 'FROM_SALE_ESTIMATE_NOT_FOUND', code: 1200 },
],
});
}
if (error.errorType === 'SALE_ESTIMATE_CONVERTED_TO_INVOICE') {
return res.boom.badRequest(null, {
errors: [
{ type: 'SALE_ESTIMATE_IS_ALREADY_CONVERTED_TO_INVOICE', code: 1300 },
],
});
}
}
next(error);
}