mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Removed unused api object from apps proxy
no-issue This is not used by any current apps, and apps are considered deprecated.
This commit is contained in:
parent
9ed6da588a
commit
65f16f77a7
1 changed files with 0 additions and 36 deletions
|
@ -1,5 +1,3 @@
|
|||
const _ = require('lodash');
|
||||
const api = require('../../api/v0.1');
|
||||
const helpers = require('../../helpers/register');
|
||||
const filters = require('../../filters');
|
||||
const common = require('../../lib/common');
|
||||
|
@ -12,25 +10,6 @@ module.exports.getInstance = function getInstance(name) {
|
|||
|
||||
const appRouter = routingService.registry.getRouter('appRouter');
|
||||
|
||||
const passThruAppContextToApi = (apiMethods) => {
|
||||
const appContext = {
|
||||
app: name
|
||||
};
|
||||
|
||||
return _.reduce(apiMethods, function (memo, apiMethod, methodName) {
|
||||
memo[methodName] = function (...args) {
|
||||
const options = args[args.length - 1];
|
||||
|
||||
if (_.isObject(options)) {
|
||||
options.context = _.clone(appContext);
|
||||
}
|
||||
return apiMethod.apply({}, args);
|
||||
};
|
||||
|
||||
return memo;
|
||||
}, {});
|
||||
};
|
||||
|
||||
return {
|
||||
filters: {
|
||||
register: filters.registerFilter.bind(filters),
|
||||
|
@ -44,21 +23,6 @@ module.exports.getInstance = function getInstance(name) {
|
|||
routeService: {
|
||||
// This allows for mounting an entirely new Router at a path...
|
||||
registerRouter: appRouter.mountRouter.bind(appRouter)
|
||||
},
|
||||
// Mini proxy to the API - needs review
|
||||
api: {
|
||||
posts: passThruAppContextToApi(
|
||||
_.pick(api.posts, 'browse', 'read', 'edit', 'add', 'destroy')
|
||||
),
|
||||
tags: passThruAppContextToApi(
|
||||
_.pick(api.tags, 'browse')
|
||||
),
|
||||
notifications: passThruAppContextToApi(
|
||||
_.pick(api.notifications, 'browse', 'add', 'destroy')
|
||||
),
|
||||
settings: passThruAppContextToApi(
|
||||
_.pick(api.settings, 'browse', 'read', 'edit')
|
||||
)
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue