Skip to content

Commit

Permalink
feat: filter staging results by table
Browse files Browse the repository at this point in the history
  • Loading branch information
frantzarty committed Apr 19, 2022
1 parent 4814122 commit 31055b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/controllers/staging.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/validations/staging.validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

0 comments on commit 31055b3

Please sign in to comment.