mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 03:22:21 +03:00
Updated Member model to handle stripe_info property
no-issue This maps the stripe_info property to the MemberStripeInfo model, so that we can update the member model, and correctly add/edit rows in the members-stripe-info table.
This commit is contained in:
parent
e54adfd30d
commit
c9b4fa4a09
@ -1,7 +1,24 @@
|
|||||||
const ghostBookshelf = require('./base');
|
const ghostBookshelf = require('./base');
|
||||||
|
|
||||||
const Member = ghostBookshelf.Model.extend({
|
const Member = ghostBookshelf.Model.extend({
|
||||||
tableName: 'members'
|
tableName: 'members',
|
||||||
|
|
||||||
|
relationships: ['stripe_info'],
|
||||||
|
relationshipBelongsTo: {
|
||||||
|
stripe_info: 'members_stripe_info'
|
||||||
|
},
|
||||||
|
|
||||||
|
permittedAttributes(...args) {
|
||||||
|
return ghostBookshelf.Model.prototype.permittedAttributes.apply(this, args).concat(this.relationships);
|
||||||
|
},
|
||||||
|
|
||||||
|
stripe_info() {
|
||||||
|
return this.hasMany('MemberStripeInfo', 'member_id');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
permittedOptions(...args) {
|
||||||
|
return ghostBookshelf.Model.permittedOptions.apply(this, args).concat(['withRelated']);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const Members = ghostBookshelf.Collection.extend({
|
const Members = ghostBookshelf.Collection.extend({
|
||||||
|
Loading…
Reference in New Issue
Block a user