Removed /collections/:id/posts endpoint

refs https://github.com/TryGhost/Arch/issues/16

- We made a decision to limit the API for fetching posts belonging to a certain collection to only the Posts API. The endpoint on the collections was an experiment that only brings unnecessary maintenance at this point of time.
This commit is contained in:
Naz 2023-07-21 19:02:31 +08:00 committed by naz
parent 9a38c65ee6
commit 08c06129d3
4 changed files with 0 additions and 34 deletions

View File

@ -25,25 +25,6 @@ module.exports = {
}
},
browsePosts: {
headers: {
cacheInvalidate: false
},
data: [
'id'
],
options: [
'limit',
'page'
],
permissions: {
method: 'browse'
},
query(frame) {
return collectionsService.api.getAllPosts(frame.data.id, frame.options);
}
},
read: {
headers: {
cacheInvalidate: false

View File

@ -1,10 +0,0 @@
const collectionPostsMapper = require('./mappers/collection-posts');
module.exports = {
browsePosts(response, apiConfig, frame) {
frame.response = {
collection_posts: response.data.map(model => collectionPostsMapper(model)),
meta: response.meta
};
}
};

View File

@ -21,10 +21,6 @@ module.exports = {
return require('./authentication');
},
get collections() {
return require('./collections');
},
get db() {
return require('./db');
},

View File

@ -25,7 +25,6 @@ module.exports = function apiRoutes() {
router.post('/collections', mw.authAdminApi, labs.enabledMiddleware('collections'), http(api.collections.add));
router.put('/collections/:id', mw.authAdminApi, labs.enabledMiddleware('collections'), http(api.collections.edit));
router.del('/collections/:id', mw.authAdminApi, labs.enabledMiddleware('collections'), http(api.collections.destroy));
router.get('/collections/:id/posts', mw.authAdminApi, labs.enabledMiddleware('collections'), http(api.collections.browsePosts));
// ## Configuration
router.get('/config', mw.authAdminApi, http(api.config.read));