You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our current implementation Ghost returns inconsistent results for GET requests that return more than one object (e.g. /ghost/api/v0.1/tags/). users, tags, settings and soon apps return all elements from the database. posts returns a paginated result with meta information. This behavior is inconsistent and should be changed to return a paginated result for all API calls that return multiple objects.
The post model has findAll() and findPage() methods atm. findAll() returns all existing post objects and is only used for deleting all content. We would like to keep the use case but remove findAll() by allowing all to be passed as limit parameter.
Default pagination options:
page: 1
limit: 15 (allows all)
I think it is worth investigating if it is possible to implement a generic findPage() method in base.js and override it for models with special requirements.
The text was updated successfully, but these errors were encountered:
refs TryGhost#2896
- moves repeated code out of models
- creates a new file for unit-testable code (this should be moved in future)
- adds a default for `page` as that seems sensible
- adds 100% test coverage for the new file
refs TryGhost#2896
- remove duplicate query-building code
- use the same approach for creating the count query from the main query
- restructure the code to match more closely across the 3 findPage functions (prep for further refactoring)
In our current implementation Ghost returns inconsistent results for
GET
requests that return more than one object (e.g./ghost/api/v0.1/tags/
).users
,tags
,settings
and soonapps
return all elements from the database.posts
returns a paginated result with meta information. This behavior is inconsistent and should be changed to return a paginated result for all API calls that return multiple objects.The post model has
findAll()
andfindPage()
methods atm.findAll()
returns all existing post objects and is only used for deleting all content. We would like to keep the use case but removefindAll()
by allowingall
to be passed aslimit
parameter.Default pagination options:
all
)I think it is worth investigating if it is possible to implement a generic
findPage()
method inbase.js
and override it for models with special requirements.The text was updated successfully, but these errors were encountered: