Ghost/core/server/models/member-email-change-event.js
Fabien 'egg' O'Carroll 27b9e4ae04
Added member relation to events (#12656)
refs https://github.com/TryGhost/Ghost/issues/12602

When listing site-wide event, we want to include member information so
that we can contextualise the event when displaying it.
2021-02-16 16:14:20 +00:00

28 lines
847 B
JavaScript

const errors = require('@tryghost/errors');
const ghostBookshelf = require('./base');
const MemberEmailChangeEvent = ghostBookshelf.Model.extend({
tableName: 'members_email_change_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
}
}, {
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)
};