diff --git a/src/controllers/staging.controller.js b/src/controllers/staging.controller.js index cacc8c84..2deb8247 100644 --- a/src/controllers/staging.controller.js +++ b/src/controllers/staging.controller.js @@ -20,7 +20,7 @@ import { export const findAll = async (req, res) => { try { - let { page, limit, type } = req.query; + let { page, limit, type, table } = req.query; let pagination = paginationParams(page, limit); @@ -33,6 +33,10 @@ export const findAll = async (req, res) => { where = { failedCommit: true }; } + if (table) { + where.table = table; + } + let stagingData = await Staging.findAndCountAll({ distinct: true, where, diff --git a/src/validations/staging.validations.js b/src/validations/staging.validations.js index 1c8ad133..e6cfab0b 100644 --- a/src/validations/staging.validations.js +++ b/src/validations/staging.validations.js @@ -13,5 +13,6 @@ export const stagingGetQuerySchema = Joi.object() page: Joi.number(), limit: Joi.number(), type: Joi.string(), + table: Joi.string().valid('Projects', 'Units').optional(), }) .with('page', 'limit');