With a schema like the below, is there a way to execute a query and have the results sorted by the name
property of the JobType
entity? I'd like to have a paginated list of jobs, and display the results sorted by the job type name, alphabetically.
extend type Query @middleware(checks: ["auth:api"]) {
jobs(orderBy: _ @orderBy): [Job!]! @paginate(defaultCount: 10, model: "App\\Job")
}
type Job {
id: ID!
description: String!
job_type: JobType! @belongsTo
}
type JobType {
id: ID!
name: String!
}
I've tried using the @builder
directive, then using a join in the builder to bring the name property in that way, but that seems to cause some issues with entity IDs, which causes the relationships to link to the wrong things.
Any ideas?