mickhansen / graphql-sequelize

GraphQL & Relay for MySQL & Postgres via Sequelize
MIT License
1.9k stars 172 forks source link

Fix order type in defaultListArgs #712

Closed maheraldous closed 1 year ago

maheraldous commented 2 years ago

Hello

The order type in defaultListArgs should be array not string so how to change that. https://github.com/mickhansen/graphql-sequelize#defaultlistargs

Here they use array http://docs.sequelizejs.com/en/latest/docs/querying/#ordering

Here I also get an error tells me to use array but since the type is string the GraphQL types validator dose not allows me to pass the array. image

mickhansen commented 2 years ago

Have you tried reverse:id?. Also, defaultListArgs is not recommended as far as "idiomatic" GraphQL goes.

maheraldous commented 2 years ago

Hello I tried something like this

reverse:username

and this

username

But none worked

Also where filter is work but when I add conditions like like or something like that as in the Sequelize docs and your example it dose not work because also the format validation block me as in order filter but it's ok for me because it's enough to just use where without conditions

mickhansen commented 2 years ago

You're welcome to submit a PR but I would simply recommend against relying on defaultListArgs

maheraldous commented 2 years ago

I will appreciate if you just change the type input of order to array this is the only issue of this case. But if you aren't able to do that it's bot a problem.

mickhansen commented 2 years ago

@maheraldous It's not that simple, this has worked previously so it must be related to the Sequelize version you're using. So any change needs to make sure it also works for older versions, and as I mentioned I consider defaultListArgs to be less-than-ideal. But I always welcome PRs :)

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.