mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 04:13:30 +03:00
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:
parent
f049e89a20
commit
33f176a9de
@ -1,7 +1,6 @@
|
|||||||
const tpl = require('@tryghost/tpl');
|
const tpl = require('@tryghost/tpl');
|
||||||
const errors = require('@tryghost/errors');
|
const errors = require('@tryghost/errors');
|
||||||
const models = require('../../models');
|
const models = require('../../models');
|
||||||
const postsPublicService = require('../../services/posts-public');
|
|
||||||
|
|
||||||
const ALLOWED_INCLUDES = ['tags', 'authors', 'tiers'];
|
const ALLOWED_INCLUDES = ['tags', 'authors', 'tiers'];
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
permissions: true,
|
permissions: true,
|
||||||
query(frame) {
|
query(frame) {
|
||||||
return postsPublicService.api.browse(frame.options);
|
return models.Post.findPage(frame.options);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
permissions: true,
|
permissions: true,
|
||||||
query(frame) {
|
query(frame) {
|
||||||
return postsPublicService.api.browse(frame.options);
|
return models.Post.findPage(frame.options);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ class PostsPublicServiceWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wire up all the dependencies
|
// Wire up all the dependencies
|
||||||
const {Post} = require('../../models');
|
|
||||||
const adapterManager = require('../adapter-manager');
|
const adapterManager = require('../adapter-manager');
|
||||||
const config = require('../../../shared/config');
|
const config = require('../../../shared/config');
|
||||||
const EventAwareCacheWrapper = require('@tryghost/event-aware-cache-wrapper');
|
const EventAwareCacheWrapper = require('@tryghost/event-aware-cache-wrapper');
|
||||||
@ -36,8 +35,7 @@ class PostsPublicServiceWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.api = {
|
this.api = {
|
||||||
cache: cache,
|
cache: cache
|
||||||
browse: this.postsRepository.getAll.bind(this.postsRepository)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user