-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content API V2: Don't return authors and tags without posts #10124
Comments
We discussed an alternative solution to this in slack: model splitting. Pre API versioning, Ghost used a single 1:1:1 table:model:api for each of Posts, Tags and Users. We can represent Published posts, Public Tags (includes internal tags!) and Authors as separate models, which automatically have filters built into them, implemented very similarly to a soft delete plugin. This will allow us to more easily have frontend business logic defaults for ordering, filtering, limits etc for the Content API, and a different set of more generic defaults for the Admin API. |
refs TryGhost#10124 - Author model returns only users that have published non page posts
refs #10124 - Author model returns only users that have published non-page posts - Added a public controller for tags (should be extracted to separate Content API controller #10106) - Made resource configuration dynamic based on current theme engine - This needs a follow-up PR with fixes to the problems described in the PR
As d3f3b3d has landed in master there are 2 main problems that need to be addressed before the release described in detail here. In short:
|
refs TryGhost#10124 - one clean v0.1 and v2 config file for routing
refs #10124 - one clean v0.1 and v2 config file for routing! - solves one underlying bug reported in #10124 - the alias handling was just a hotfix to support v2 for the site - but it was hard to read, ugly - now we have two clean configs - we'll see how useful it is - need to do proper manual testing on Monday
All checkboxes ticked, time to close this issue 🎉 |
(refs #9866)
This is a change for API v2 only.
The Content API should not return authors or tags with no posts.
Use Case
You have an administrator which organises the blog, but does not write posts.
Things to take care of
Requirements/Underlying problem
GQL does not support filtering and couting e.g.
filter=count.posts:>0
. We first need to finish NQL and replace GQL with NQL in Ghost.The sitemap service depends on the url service. And the url service is independent of API versions. The url service fetches data in bootstrap straight from the model layer. That means urls are being created independently from the API result/behaviour. e.g. v0.1 should show author urls with posts count 0 and v2 should not show them.
IMO we need to refactor the url service to request the configured (by the theme) API version. And if the theme changes the api version, we need to purge the url service and rebuild the cache. The challenge here is that we need to execute raw knex queries, because bookshelf is too slow e.g.
api.v2.posts.all()
This needs some more thoughts and architecture ideas.
Hacky solution
It's possible to hack this feature into V2 without resolving the requirements, but it's really ugly and hard to maintain. See PR: #10123
TODO
The text was updated successfully, but these errors were encountered: