【发布时间】:2022-07-12 03:53:57
【问题描述】:
我在另一个关系上遇到问题。我希望能够对前端关系中的列标题进行排序。这是我的设置:
extend type Query {
entries(first: Int!,
page: Int,
type: String @eq,
site_id: ID @eq,
orderBy: _ @orderBy(
columns: ["created_at", "published_at"],
relations: [{ relation: "content", columns: ["title"] }]
)
): [Entry!]! @paginate
}
export const ALL_SITE_ENTRIES = gql`
query Entries(
$first: Int!,
$page: Int,
$type: String,
$site_id: ID,
$title: Mixed = null,
$orderBy: [EntriesOrderByOrderByClause!]) {
entries(
first: $first,
page: $page,
type: $type,
site_id: $site_id,
hasContent: {column: TITLE, operator: LIKE, value: $title},
orderBy: $orderBy
) {
data {
...EntryDetails
content{
id
title
status
}
}
paginatorInfo {
currentPage
lastPage
total
}
}
}
${EntryDetailsFragment}
`
Now according to the documentation on sorting, 这应该没问题。在工作中发布和创建都很好而且花花公子。当我尝试按标题排序时,按
我的阿波罗号:
this.$apollo.addSmartQuery('entries', {
query: ALL_SITE_ENTRIES,
fetchPolicy: 'no-cache',
variables() {
return {
type: this.entryType,
site_id: null,
blog_type: this.siteSettings.blog_type,
first: 25,
page: this.selectedPage,
orderBy: [{content: {column: 'TITLE'}, order: 'DESC'}],
}
},
});
我收到错误 Expected type EntriesOrderByColumn at value[0].field。仅在作品中发布:[{field: 'PUBLISHED_AT', order: 'DESC'}] 我从错误和文档中的内容中得到了混合信号。帮忙?
【问题讨论】:
标签: graphql laravel-lighthouse