Skip to content

Commit

Permalink
refactor(apps): move ordering thoughts to api
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnigos committed Sep 29, 2024
1 parent 20a1073 commit 5e2070d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apps/api/src/thoughts/thoughts.router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ describe('ThoughtsRouter', () => {
author: true,
createdAt: true,
},
orderBy: {
createdAt: 'desc',
},
})
})
})
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/thoughts/thoughts.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export class ThoughtsRouter {
author: true,
createdAt: true,
},
orderBy: {
createdAt: 'desc',
},
})
}
}
2 changes: 1 addition & 1 deletion apps/web/app/thoughts/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function ThoughtsPage() {
</header>

<div className="flex flex-col gap-2">
{thoughts.toReversed().map(({ id, content, author }) => (
{thoughts.map(({ id, content, author }) => (
<ThoughtCard
key={id}
id={id}
Expand Down

0 comments on commit 5e2070d

Please sign in to comment.