Skip to content

Commit

Permalink
Merge pull request #65 from dagmawig/main
Browse files Browse the repository at this point in the history
feat: add default order by created_at desc
  • Loading branch information
dadiorchen authored Feb 1, 2022
2 parents 8c87c7b + 69b5e66 commit fcea813
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions server/models/Tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ function getByFilter(
*/
function getFeaturedTree(treeRepository: TreeRepository) {
return async function () {
// const trees = await treeRepository.getByFilter(
// {
// approved: true,
// }, {limit: 10});
const trees: Array<Tree> = [];
// eslint-disable-next-line no-restricted-syntax
for (const id of [186737, 186735, 186736, 186734]) {
// eslint-disable-next-line no-await-in-loop
const tree = await treeRepository.getById(id);
trees.push(tree);
}
const trees = await treeRepository.getByFilter(
{
approved: true,
},
{ limit: 10, orderBy: { column: 'created_at', direction: 'desc' } },
);
// const trees: Array<Tree> = [];
// // eslint-disable-next-line no-restricted-syntax
// for (const id of [186737, 186735, 186736, 186734]) {
// // eslint-disable-next-line no-await-in-loop
// const tree = await treeRepository.getById(id);
// trees.push(tree);
// }
return trees;
};
}
Expand Down

0 comments on commit fcea813

Please sign in to comment.