diff --git a/ghost/core/core/server/api/endpoints/pages-public.js b/ghost/core/core/server/api/endpoints/pages-public.js index 37adf11e50..a3ffe3a366 100644 --- a/ghost/core/core/server/api/endpoints/pages-public.js +++ b/ghost/core/core/server/api/endpoints/pages-public.js @@ -1,7 +1,6 @@ const tpl = require('@tryghost/tpl'); const errors = require('@tryghost/errors'); const models = require('../../models'); -const postsPublicService = require('../../services/posts-public'); const ALLOWED_INCLUDES = ['tags', 'authors', 'tiers']; @@ -36,7 +35,7 @@ module.exports = { }, permissions: true, query(frame) { - return postsPublicService.api.browse(frame.options); + return models.Post.findPage(frame.options); } }, diff --git a/ghost/core/core/server/api/endpoints/posts-public.js b/ghost/core/core/server/api/endpoints/posts-public.js index a38aeabd73..e63bbef52a 100644 --- a/ghost/core/core/server/api/endpoints/posts-public.js +++ b/ghost/core/core/server/api/endpoints/posts-public.js @@ -37,7 +37,7 @@ module.exports = { }, permissions: true, query(frame) { - return postsPublicService.api.browse(frame.options); + return models.Post.findPage(frame.options); } }, diff --git a/ghost/core/core/server/services/posts-public/service.js b/ghost/core/core/server/services/posts-public/service.js index cc681fa2bf..584f0b5e42 100644 --- a/ghost/core/core/server/services/posts-public/service.js +++ b/ghost/core/core/server/services/posts-public/service.js @@ -6,7 +6,6 @@ class PostsPublicServiceWrapper { } // Wire up all the dependencies - const {Post} = require('../../models'); const adapterManager = require('../adapter-manager'); const config = require('../../../shared/config'); const EventAwareCacheWrapper = require('@tryghost/event-aware-cache-wrapper'); @@ -36,8 +35,7 @@ class PostsPublicServiceWrapper { } this.api = { - cache: cache, - browse: this.postsRepository.getAll.bind(this.postsRepository) + cache: cache }; } }