Skip to content

Commit d16c5e2

Browse files
committed
Backend postsConnection
1 parent 04a1e5a commit d16c5e2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

backend/query.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ const Query = prismaObjectType({
77
name: 'Query',
88
definition: (t) => {
99
t.prismaFields(['post'])
10-
t.list.field('feed', {
11-
type: 'Post',
12-
resolve: (_, args, ctx) =>
13-
ctx.prisma.posts({ where: { published: true } }),
10+
t.field('feed', {
11+
type: 'PostConnection',
12+
args: {},
13+
resolve: (_, args, ctx) => {
14+
return ctx.prisma.postsConnection({ where: { published: true } })
15+
},
1416
})
1517
t.list.field('drafts', {
1618
type: 'Post',

0 commit comments

Comments
 (0)