I'm using Lighthouse with GraphQL and trying to figure out how to pass in a param into a relationship (I have a feeling I'm not using the right terms).
Here's what I got:
type Entry {
id: ID!
site_id: ID
slug: String!
admin_note: String
type: String!
sub_type: String
content(status: String): EntryContent @hasOne
versions: [EntryContent!]! @hasMany
magazineIssues: [MagazineIssue]! @belongsToMany
contentPackages: [ContentPackage]! @belongsToMany
published_at: DateTime
created_at: DateTime
updated_at: DateTime
deleted_at: DateTime
}
# Query
entries(first: Int!, page: Int, type: String @eq, site_id: ID @eq, status: String): [Entry!]! @paginate
export const ALL_SITE_ENTRIES = gql`
query Entries($first: Int!, $page: Int, $type: String, $site_id: ID, $status: String) {
entries(first: $first, page: $page, type: $type, site_id: $site_id, status: $status) {
data {
...EntryDetails
content(status: $status) {
id
title
status
}
}
paginatorInfo {
currentPage
lastPage
total
}
}
}
${EntryDetailsFragment}
`
I'm querying Entries with paginate, but I need to pass in a param for a specific content status. I tried the one above and I'm getting the error:
message: "Fields \"content\" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional."
But I don't understand why I'd need an alias for param like this. Is there a way to pass in a param into a relationship/query?
Thanks!