1 回答

TA贡献1827条经验 获得超8个赞
又找了一个小时,终于找到了。我将我的 graphql 文件更新为:
type Query {
user(firstName: String @eq orderBy: [OrderByClause!] @orderBy): [User!]! @paginate(type: "paginator" model: "App\\User")
}
type User {
id: ID!
firstName: String!
lastName: String!
birthDate: DateTime!
email: String!
created_at: DateTime!
updated_at: DateTime!
}
input OrderByClause{
field: String!
order: SortOrder!
}
enum SortOrder {
ASC
DESC
}
现在使用此查询将按出生日期正确排序它们:
query {
user(count:20, firstName:"Foo", orderBy: [
{
field: "birthDate"
order: DESC
}
]) {
data {
name
region
birthDate
}
}
}
- 1 回答
- 0 关注
- 163 浏览
添加回答
举报