File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,15 @@ export async function GET(request: NextRequest) {
12
12
const skip = ( page - 1 ) * pageSize
13
13
14
14
// Fetch paginated posts from Prisma
15
- const posts = await prisma . post . findMany ( {
15
+ const posts = await prisma . redditPost . findMany ( {
16
16
orderBy : { createdAt : 'desc' } ,
17
17
skip,
18
18
take : pageSize ,
19
19
// select: { id: true, title: true, ... } // You can choose which fields to return
20
20
} )
21
21
22
22
// 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 ( )
24
24
25
25
return NextResponse . json ( {
26
26
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
10
10
const postsPerPage = 10
11
11
const currentPage = parseInt ( searchParams . page || '1' , 10 )
12
12
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 ( {
15
15
skip : ( currentPage - 1 ) * postsPerPage ,
16
16
take : postsPerPage ,
17
17
orderBy : { createdAt : 'desc' } ,
You can’t perform that action at this time.
0 commit comments