BIG-60: fix response [object] when delete any sale estimate.

This commit is contained in:
a.bouhuolia
2021-09-13 19:35:42 +02:00
parent 1bcd55e794
commit aabcf71621
3 changed files with 27 additions and 15 deletions

View File

@@ -413,11 +413,6 @@ export default class SalesEstimatesController extends BaseController {
errors: [{ type: 'NOT_SELL_ABLE_ITEMS', code: 800 }],
});
}
if (error.errorType === 'SALE_ESTIMATE_ALREADY_APPROVED') {
return res.boom.badRequest(null, {
errors: [{ type: 'CUSTOMER_NOT_FOUND', code: 900 }],
});
}
if (error.errorType === 'SALE_ESTIMATE_ALREADY_APPROVED') {
return res.boom.badRequest(null, {
errors: [{ type: 'CUSTOMER_NOT_FOUND', code: 1000 }],
@@ -443,6 +438,16 @@ export default class SalesEstimatesController extends BaseController {
errors: [{ type: 'SALE_ESTIMATE_NO_IS_REQUIRED', code: 1400 }],
});
}
if (error.errorType === 'SALE_ESTIMATE_CONVERTED_TO_INVOICE') {
return res.boom.badRequest(null, {
errors: [{ type: 'SALE_ESTIMATE_CONVERTED_TO_INVOICE', code: 1500 }],
});
}
if (error.errorType === 'SALE_ESTIMATE_ALREADY_DELIVERED') {
return res.boom.badRequest(null, {
errors: [{ type: 'SALE_ESTIMATE_ALREADY_DELIVERED', code: 1600 }],
});
}
}
next(error);
}