Refactored direct usages of api controllers

refs #9866

- if we start with v2 controllers, the code base should not require specific api controllers
- because e.g. `require('../api/posts')` will no longer exist
- if you require the api folder, you will get the latest available version by default e.g. `require('../api').posts`
- this branch does not touch the test env (!)
This commit is contained in:
kirrg001 2018-09-20 17:36:47 +02:00 committed by Nazar Gargol
parent 727ff183f4
commit bc4b637e30
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,6 @@ const Promise = require('bluebird'),
localUtils = require('../utils'), localUtils = require('../utils'),
common = require('../../../lib/common'), common = require('../../../lib/common'),
models = require('../../../models'), models = require('../../../models'),
schedules = require('../../../api/schedules'),
urlService = require('../../../services/url'), urlService = require('../../../services/url'),
_private = {}; _private = {};
@ -25,7 +24,8 @@ _private.loadClient = function loadClient() {
}; };
_private.loadScheduledPosts = function () { _private.loadScheduledPosts = function () {
return schedules.getScheduledPosts() const api = require('../../../api');
return api.schedules.getScheduledPosts()
.then((result) => { .then((result) => {
return result.posts || []; return result.posts || [];
}); });

View File

@ -6,7 +6,7 @@ const Promise = require('bluebird'),
models = require('../models'), models = require('../models'),
config = require('../config'), config = require('../config'),
common = require('../lib/common'), common = require('../lib/common'),
postsAPI = require('../api/posts'); postsAPI = require('./posts');
/** /**
* Publish a scheduled post * Publish a scheduled post