Refactored posts browsing to posts service
refs https://github.com/TryGhost/Team/issues/3423 - This refactor allow for smaller and cleaner change that's coming up when dealing with `?collection=` query parameter
This commit is contained in:
parent
cfbc97b033
commit
1d214361ad
@ -69,7 +69,7 @@ module.exports = {
|
||||
unsafeAttrs: unsafeAttrs
|
||||
},
|
||||
query(frame) {
|
||||
return models.Post.findPage(frame.options);
|
||||
return postsService.browsePosts(frame.options);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -27,6 +27,15 @@ class PostsService {
|
||||
this.collectionsService = collectionsService;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Object} options - frame options
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async browsePosts(options) {
|
||||
return this.models.Post.findPage(options);
|
||||
}
|
||||
|
||||
async readPost(frame) {
|
||||
const model = await this.models.Post.findOne(frame.data, frame.options);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user