Skip to content

Commit 99a1fa4

Browse files
committed
Updated prisma posts queries to redditPost.
1 parent 1cd633c commit 99a1fa4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/app/api/reddit/posts/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ export async function GET(request: NextRequest) {
1212
const skip = (page - 1) * pageSize
1313

1414
// Fetch paginated posts from Prisma
15-
const posts = await prisma.post.findMany({
15+
const posts = await prisma.redditPost.findMany({
1616
orderBy: { createdAt: 'desc' },
1717
skip,
1818
take: pageSize,
1919
// select: { id: true, title: true, ... } // You can choose which fields to return
2020
})
2121

2222
// Optionally, get the total number of posts to return along with pagination info
23-
const totalCount = await prisma.post.count()
23+
const totalCount = await prisma.redditPost.count()
2424

2525
return NextResponse.json({
2626
data: posts,

src/app/jobs/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export default async function Home(props: { searchParams: Promise<{ page?: strin
1010
const postsPerPage = 10
1111
const currentPage = parseInt(searchParams.page || '1', 10)
1212

13-
const totalPosts = await prisma.post.count()
14-
const posts = await prisma.post.findMany({
13+
const totalPosts = await prisma.redditPost.count()
14+
const posts = await prisma.redditPost.findMany({
1515
skip: (currentPage - 1) * postsPerPage,
1616
take: postsPerPage,
1717
orderBy: { createdAt: 'desc' },

0 commit comments

Comments
 (0)