0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/adapters/scheduling/post-scheduling/scheduler-intergation.js
Kenneth Fitzgerald 5fb93535f0
Replaced i18n.t w/ tpl helper in scheduler-intergation (#13399)
refs: #13380
The i18n package is deprecated. It is being replaced with the tpl package.

Co-authored-by: Kenneth Fitzgerald <fitzgeraldkd@gmail.com>
2021-10-01 10:38:13 +01:00

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;