Cleaned up use of public-resource-repository

no issue

- The caching has been moved down the layer  - the the api-framework's "pipeline", so there's no need to add complexity to post fetching logic with repository pattern.
This commit is contained in:
Naz 2023-02-23 11:40:55 +08:00
parent f049e89a20
commit 33f176a9de
No known key found for this signature in database
3 changed files with 3 additions and 6 deletions

View File

@ -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);
}
},

View File

@ -37,7 +37,7 @@ module.exports = {
},
permissions: true,
query(frame) {
return postsPublicService.api.browse(frame.options);
return models.Post.findPage(frame.options);
}
},

View File

@ -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
};
}
}