Skip to content

Commit

Permalink
Add desc on orderby
Browse files Browse the repository at this point in the history
  • Loading branch information
tombakerjr committed Jul 29, 2024
1 parent 8f155ad commit 2b957b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Link from "next/link";
import { drizzle } from "drizzle-orm/d1";
import { getRequestContext } from "@cloudflare/next-on-pages";
import { table as postsTable } from "@/server/posts";
import { count } from "drizzle-orm";
import { count, desc } from "drizzle-orm";
import { type InferSelectModel } from "drizzle-orm";

// FIXME: Set this to 10 after pagination testing
Expand All @@ -19,7 +19,7 @@ const getPosts = async ({ currentPage }: { currentPage: number }): Promise<Array
const results = await db
.select()
.from(postsTable)
.orderBy(postsTable.createdOn)
.orderBy(desc(postsTable.createdOn))
.limit(PAGE_SIZE)
.offset(PAGE_SIZE * (currentPage - 1));

Expand Down

0 comments on commit 2b957b6

Please sign in to comment.