diff --git a/core/server/models/index.js b/core/server/models/index.js index ed527bdd4a..6c22bcdc2b 100644 --- a/core/server/models/index.js +++ b/core/server/models/index.js @@ -30,6 +30,7 @@ const models = [ 'member', 'member-subscribe-event', 'member-login-event', + 'member-email-change-event', 'member-payment-event', 'member-status-event', 'posts-meta', diff --git a/core/server/models/member-email-change-event.js b/core/server/models/member-email-change-event.js new file mode 100644 index 0000000000..1e0071cbc7 --- /dev/null +++ b/core/server/models/member-email-change-event.js @@ -0,0 +1,23 @@ +const errors = require('@tryghost/errors'); +const ghostBookshelf = require('./base'); + +const MemberEmailChangeEvent = ghostBookshelf.Model.extend({ + tableName: 'members_email_change_events' +}, { + async edit() { + throw new errors.IncorrectUsageError('Cannot edit MemberEmailChangeEvent'); + }, + + async destroy() { + throw new errors.IncorrectUsageError('Cannot destroy MemberEmailChangeEvent'); + } +}); + +const MemberEmailChangeEvents = ghostBookshelf.Collection.extend({ + model: MemberEmailChangeEvent +}); + +module.exports = { + MemberEmailChangeEvent: ghostBookshelf.model('MemberEmailChangeEvent', MemberEmailChangeEvent), + MemberEmailChangeEvents: ghostBookshelf.collection('MemberEmailChangeEvents', MemberEmailChangeEvents) +}; diff --git a/core/server/services/members/api.js b/core/server/services/members/api.js index 098cd17f3d..8929daa50c 100644 --- a/core/server/services/members/api.js +++ b/core/server/services/members/api.js @@ -171,6 +171,7 @@ function createApiInstance(config) { Member: models.Member, MemberSubscribeEvent: models.MemberSubscribeEvent, MemberLoginEvent: models.MemberLoginEvent, + MemberEmailChangeEvent: models.MemberEmailChangeEvent, MemberPaymentEvent: models.MemberPaymentEvent, MemberStatusEvent: models.MemberStatusEvent },