mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Added monthly & yearly price relation to Product
refs https://github.com/TryGhost/Team/issues/710 This allows us to fetch the default monthly and yearly price models for a product model, which is important since we no longer want to expose the entire list of prices, but just the designated monthly & yearly prices.
This commit is contained in:
parent
035a38680e
commit
52a97957e1
1 changed files with 8 additions and 0 deletions
|
@ -25,6 +25,14 @@ const Product = ghostBookshelf.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
monthlyPrice() {
|
||||
return this.belongsTo('StripePrice', 'monthly_price_id', 'id');
|
||||
},
|
||||
|
||||
yearlyPrice() {
|
||||
return this.belongsTo('StripePrice', 'yearly_price_id', 'id');
|
||||
},
|
||||
|
||||
stripeProducts() {
|
||||
return this.hasMany('StripeProduct', 'product_id', 'id');
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue