File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff 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' } ,
You can’t perform that action at this time.
0 commit comments