0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00
ghost/core/server/services/api-version-compatibility/index.js
Naz b56557ea04 Hooked up api version compatibility service
refs https://github.com/TryGhost/Toolbox/issues/280

- This is continuation of putting pieces together to allow Ghost notifying owner and admin users about version mismatch errors
-  This changeset adds the api-version-compatibility intialization during the boot (needed to be able to pospone the send email initialization so that it's testeable from the e2e tests)
- There's also a data service which handles fetching/saving notifications and fetching emails of users that should be notified
2022-04-22 16:31:56 +08:00

24 lines
736 B
JavaScript

const APIVersionCompatibilityService = require('@tryghost/api-version-compatibility-service');
const {GhostMailer} = require('../mail');
const {
getNotificationEmails,
fetchNotification,
saveNotification
} = require('./version-notifications-data-service');
const ghostMailer = new GhostMailer();
const init = () => {
this.APIVersionCompatibilityServiceInstance = new APIVersionCompatibilityService({
sendEmail: (options) => {
return ghostMailer.send(options);
},
fetchEmailsToNotify: getNotificationEmails,
fetchHandled: fetchNotification,
saveHandled: saveNotification
});
};
module.exports.APIVersionCompatibilityServiceInstance;
module.exports.init = init;