mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
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
2 changed files with 10 additions and 1 deletions
|
@ -69,7 +69,7 @@ module.exports = {
|
||||||
unsafeAttrs: unsafeAttrs
|
unsafeAttrs: unsafeAttrs
|
||||||
},
|
},
|
||||||
query(frame) {
|
query(frame) {
|
||||||
return models.Post.findPage(frame.options);
|
return postsService.browsePosts(frame.options);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,15 @@ class PostsService {
|
||||||
this.collectionsService = collectionsService;
|
this.collectionsService = collectionsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {Object} options - frame options
|
||||||
|
* @returns {Promise<Object>}
|
||||||
|
*/
|
||||||
|
async browsePosts(options) {
|
||||||
|
return this.models.Post.findPage(options);
|
||||||
|
}
|
||||||
|
|
||||||
async readPost(frame) {
|
async readPost(frame) {
|
||||||
const model = await this.models.Post.findOne(frame.data, frame.options);
|
const model = await this.models.Post.findOne(frame.data, frame.options);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue