How would I change the way a type is resolved in n...
# orm-help
a
How would I change the way a type is resolved in nexus? I don't like the way my notes are being returned and I want them to be in some order by position value. No matter what type of query it's returned from. So if I had a query like this
Copy code
{
  project(id: "40f04272-35eb-4b38-9d3b-b47df2efe897") {
    id
    description
    columns {
      id
      name
      notes {
        id
        title
        text
        position
      }
    }
  }
}
Or
Copy code
{
  column(where:{id:"8ff1cdb8-17f1-4f40-b3de-1676567d823a"}){
    name
    notes {
      id
      title
      text
      position
    }
  }
}
I always want the notes array objects to be in
a.position - b.position
order.
tried reordering the notes on the front end but I got this error.
Copy code
TypeError: Cannot assign to read only property '0' of object '[object Array]'
so I think I need to do it at at the resolver level
r
Hey @Awey 👋 Could you try adding an order by to the notes as follows:
Copy code
{
  project(id: "40f04272-35eb-4b38-9d3b-b47df2efe897") {
    id
    description
    columns {
      id
      name
      notes(orderBy: { position: ASC }) {
        id
        title
        text
        position
      }
    }
  }
}
For this you would have to add
ordering: true
to your notes in the Project object definition in Nexus