Ghost/core/server/models/member-email-change-event.js
Sam Lord 18b8eddd0d Added linting for use of @tryghost/errors
refs: https://github.com/TryGhost/Toolbox/issues/147
Errors in @tryghost/errors rely on being called with an object (with a `message` member) rather than with a string.
2021-12-01 11:22:21 +00:00

28 lines
869 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({message: 'Cannot edit MemberEmailChangeEvent'});
},
async destroy() {
throw new errors.IncorrectUsageError({message: 'Cannot destroy MemberEmailChangeEvent'});
}
});
const MemberEmailChangeEvents = ghostBookshelf.Collection.extend({
model: MemberEmailChangeEvent
});
module.exports = {
MemberEmailChangeEvent: ghostBookshelf.model('MemberEmailChangeEvent', MemberEmailChangeEvent),
MemberEmailChangeEvents: ghostBookshelf.collection('MemberEmailChangeEvents', MemberEmailChangeEvents)
};