Ghost/core/server/models/member-cancel-event.js
Thibaut Patel 4ce9a5a167 Added the MemberCancelEvent model
refs https://github.com/TryGhost/Team/issues/1302

- This event stores the members' subscription cancelations.
2022-03-11 21:50:06 +01:00

29 lines
809 B
JavaScript

const errors = require('@tryghost/errors');
const ghostBookshelf = require('./base');
const MemberCancelEvent = ghostBookshelf.Model.extend({
tableName: 'members_cancel_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
}
}, {
async edit() {
throw new errors.IncorrectUsageError({message: 'Cannot edit MemberCancelEvent'});
},
async destroy() {
throw new errors.IncorrectUsageError({message: 'Cannot destroy MemberCancelEvent'});
}
});
const MemberCancelEvents = ghostBookshelf.Collection.extend({
model: MemberCancelEvent
});
module.exports = {
MemberCancelEvent: ghostBookshelf.model('MemberCancelEvent', MemberCancelEvent),
MemberCancelEvents: ghostBookshelf.collection('MemberCancelEvents', MemberCancelEvents)
};