Skip to content

Commit

Permalink
Merge pull request #455 from Chia-Network/feature/add-ordering-query-…
Browse files Browse the repository at this point in the history
…param

feat: add ordering query param to audit table
  • Loading branch information
MichaelTaylor3D authored Apr 7, 2022
2 parents d2a0ae9 + 1d7c429 commit b1f2617
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/controllers/audit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ import {

export const findAll = async (req, res) => {
try {
let { page, limit, orgUid } = req.query;
let { page, limit, orgUid, order } = req.query;

let pagination = paginationParams(page, limit);

const auditResults = await Audit.findAndCountAll({
where: { orgUid },
order: [['onchainConfirmationTimeStamp', order || 'DESC']],
...pagination,
});

console.log(auditResults);

return res.json(optionallyPaginatedResponse(auditResults, page, limit));
} catch (error) {
res.status(400).json({
message: 'Can not retreive issuances',
message: 'Can not retreive audit data',
error: error.message,
});
}
Expand Down
1 change: 1 addition & 0 deletions src/validations/audit.validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const auditGetSchema = Joi.object()
page: Joi.number(),
limit: Joi.number(),
orgUid: Joi.string(),
order: Joi.string().valid('ASC', 'DESC').optional(),
})
.with('page', 'limit')
.with('limit', 'page');

0 comments on commit b1f2617

Please sign in to comment.