ramsaylanier / WordExpressSchema

This package provides a connection to a WordPress database using Sequelize and provides a standard set of GraphQL queries.
148 stars 31 forks source link

Fix bug for post.categories and category.posts to use the configured wp_prefix and also enable category.posts to handle post_type and order #20

Closed iamake closed 6 years ago

iamake commented 6 years ago

Hello,

The first two commits are to fix bugs, and the last commit is an additional feature.

The additional feature is used in my project and I see it is a very general use case, so I include it in this PR for you to consider. The reason for using post_date as the default sorting order is due to the default Wordpress table index:

KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`),
ramsaylanier commented 6 years ago

Awesome thanks! I think there is a better way to use the settings to ensure the right object keys are being used. Perhaps a helper function or a map or something. I'm not sure. I think it's a bit cumbersome to have to pass in settings to each connector. But it is what it is for now. Thanks again !

ramsaylanier commented 6 years ago

@iamake also - 4.2.3 has been published to npm