refactoring: custom views service.

fix: constraints of delete item from storage.
fix: constraints of delete item category from storage.
fix: localize database seeds files.
fix: view meta data in accounts list response.
This commit is contained in:
Ahmed Bouhuolia
2020-10-05 19:09:56 +02:00
parent 0114ed9f8b
commit 99e6fe273f
64 changed files with 1593 additions and 1103 deletions

View File

@@ -297,7 +297,21 @@ export default class SalesEstimatesController extends BaseController {
* @param {Request} req
* @param {Response} res
*/
async getEstimates(req: Request, res: Response) {
async getEstimates(req: Request, res: Response, next: NextFunction) {
const { tenantId } = req;
const estimatesFilter: ISalesEstimatesFilter = this.matchedQueryData(req);
try {
const { salesEstimates, pagination, filterMeta } = await this.saleEstimateService
.estimatesList(tenantId, estimatesFilter);
return res.status(200).send({
sales_estimates: this.transfromToResponse(salesEstimates),
pagination,
filter_meta: this.transfromToResponse(filterMeta),
})
} catch (error) {
next(error);
}
}
};