这样做
query {
postsConnection(where: {
status: PUBLISHED
}) {
aggregate {
count
}
edges {
cursor
node {
id
slug
}
}
}
}
给我postsConnection
的已发布帖子。
Post
模型在字段Category
中有一个categories
枚举数组。这是datamodel
enum Category {
TECH
FIN
DIGIMARK
CODING
TUTORIAL
HOWTO
WRITING
INSPIRE
SCIENCE
POLITICS
LIFESTYLE
}
type Post {
id: ID!
title: String!
editorSerializedOutput: Json!
editorCurrentContent: Json!
editorHtml: String!
updatedAt: DateTime!
createdAt: DateTime!
author: User
authorId: String!
categories: [Category!]!
thumbnail: Json!
status: PostStatus!
slug: String!
}
我的问题是,我需要编写什么Prisma Query才能获得PostConnection
特定类别的帖子?