Skip to content

Commit

Permalink
Revert "fix: Greenstand#291 default tree order time_created"
Browse files Browse the repository at this point in the history
This reverts commit b1ea219.
  • Loading branch information
kunalznk committed Mar 16, 2023
1 parent b1ea219 commit 7dca2ea
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/routers/treesRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@ router.get(
const options: FilterOptions = {
limit,
offset,
orderBy: {
column: order_by || 'time_created',
direction: desc === true ? 'desc' : 'asc',
},
};

if (planter_id) {
filter.planter_id = planter_id;
if (order_by) {
options.orderBy = {
column: order_by === 'created_at' ? 'time_created' : order_by,
direction: desc === true ? 'desc' : 'asc',
};
}
} else if (organization_id) {
filter.organization_id = organization_id;
} else if (startDate && endDate) {
Expand Down

0 comments on commit 7dca2ea

Please sign in to comment.