mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
5fb93535f0
refs: #13380 The i18n package is deprecated. It is being replaced with the tpl package. Co-authored-by: Kenneth Fitzgerald <fitzgeraldkd@gmail.com>
26 lines
755 B
JavaScript
26 lines
755 B
JavaScript
const models = require('../../../models');
|
|
const tpl = require('@tryghost/tpl');
|
|
const errors = require('@tryghost/errors');
|
|
|
|
const messages = {
|
|
resourceNotFound: '{resource} not found.'
|
|
};
|
|
|
|
/**
|
|
* @description Load the internal scheduler integration
|
|
*
|
|
* @return {Promise}
|
|
*/
|
|
const getSchedulerIntegration = function () {
|
|
return models.Integration.findOne({slug: 'ghost-scheduler'}, {withRelated: 'api_keys'})
|
|
.then((integration) => {
|
|
if (!integration) {
|
|
throw new errors.NotFoundError({
|
|
message: tpl(messages.resourceNotFound, {resource: 'Integration'})
|
|
});
|
|
}
|
|
return integration.toJSON();
|
|
});
|
|
};
|
|
|
|
module.exports = getSchedulerIntegration;
|