Added MemberStatusEvent model

refs https://github.com/TryGhost/Ghost/issues/12602
This commit is contained in:
Fabien O'Carroll 2021-02-12 13:13:16 +00:00 committed by Fabien 'egg' O'Carroll
parent 3e228072ba
commit 1af6be63f0
3 changed files with 26 additions and 1 deletions

View File

@ -29,6 +29,7 @@ const models = [
'mobiledoc-revision', 'mobiledoc-revision',
'member', 'member',
'member-subscribe-event', 'member-subscribe-event',
'member-status-event',
'posts-meta', 'posts-meta',
'member-stripe-customer', 'member-stripe-customer',
'stripe-customer-subscription', 'stripe-customer-subscription',

View File

@ -0,0 +1,23 @@
const errors = require('@tryghost/errors');
const ghostBookshelf = require('./base');
const MemberStatusEvent = ghostBookshelf.Model.extend({
tableName: 'members_status_events'
}, {
async edit() {
throw new errors.IncorrectUsageError('Cannot edit MemberStatusEvent');
},
async destroy() {
throw new errors.IncorrectUsageError('Cannot destroy MemberStatusEvent');
}
});
const MemberStatusEvents = ghostBookshelf.Collection.extend({
model: MemberStatusEvent
});
module.exports = {
MemberStatusEvent: ghostBookshelf.model('MemberStatusEvent', MemberStatusEvent),
MemberStatusEvents: ghostBookshelf.collection('MemberStatusEvents', MemberStatusEvents)
};

View File

@ -169,7 +169,8 @@ function createApiInstance(config) {
StripeCustomer: models.MemberStripeCustomer, StripeCustomer: models.MemberStripeCustomer,
StripeCustomerSubscription: models.StripeCustomerSubscription, StripeCustomerSubscription: models.StripeCustomerSubscription,
Member: models.Member, Member: models.Member,
MemberSubscribeEvent: models.MemberSubscribeEvent MemberSubscribeEvent: models.MemberSubscribeEvent,
MemberStatusEvent: models.MemberStatusEvent
}, },
logger: logging logger: logging
}); });