0
Fork 0
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:
Fabien 'egg' O'Carroll 2021-06-01 11:00:28 +01:00 committed by GitHub
parent 035a38680e
commit 52a97957e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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');
},