refactoring: inventory adjustments list.

refactoring: items categories list.
This commit is contained in:
a.bouhuolia
2021-02-09 13:56:37 +02:00
parent 1a99584c9a
commit 6e10ed0721
32 changed files with 497 additions and 882 deletions

View File

@@ -1,6 +1,6 @@
import { Inject, Service } from 'typedi';
import { Router, Request, Response, NextFunction } from 'express';
import { check, param } from 'express-validator';
import { check, query, param } from 'express-validator';
import { ServiceError } from 'exceptions';
import BaseController from '../BaseController';
import InventoryAdjustmentService from 'services/Inventory/InventoryAdjustmentService';
@@ -39,12 +39,28 @@ export default class InventoryAdjustmentsController extends BaseController {
);
router.get(
'/',
[...this.validateListQuerySchema],
this.validationResult,
this.asyncMiddleware(this.getInventoryAdjustments.bind(this)),
this.handleServiceErrors
);
return router;
}
/**
* Validate list query schema
*/
get validateListQuerySchema() {
return [
query('column_sort_by').optional().trim().escape(),
query('sort_order').optional().isIn(['desc', 'asc']),
query('page').optional().isNumeric().toInt(),
query('page_size').optional().isNumeric().toInt(),
];
}
/**
* Quick inventory adjustment validation schema.
*/