Added description to product repository

refs https://github.com/TryGhost/Team/issues/586
refs https://github.com/TryGhost/Ghost/commit/b4d9ee0b

The `products` and `stripe_prices` were missing a description
column which will be used by Portal to display information about the
products and prices
This commit is contained in:
Rishabh 2021-05-04 21:30:16 +05:30 committed by Rishabh Garg
parent 3a27d1bd0c
commit 460dd09f8b

View File

@ -88,6 +88,7 @@ class ProductRepository {
* *
* @param {object} data * @param {object} data
* @param {string} data.name * @param {string} data.name
* @param {string} data.description
* @param {StripePriceInput[]} data.stripe_prices * @param {StripePriceInput[]} data.stripe_prices
* @param {string} data.product_id * @param {string} data.product_id
* @param {string} data.stripe_product_id * @param {string} data.stripe_product_id
@ -98,7 +99,8 @@ class ProductRepository {
**/ **/
async create(data, options) { async create(data, options) {
const productData = { const productData = {
name: data.name name: data.name,
description: data.description
}; };
const product = await this._Product.add(productData, options); const product = await this._Product.add(productData, options);
@ -150,6 +152,7 @@ class ProductRepository {
* @param {object} data * @param {object} data
* @param {string} data.id * @param {string} data.id
* @param {string} data.name * @param {string} data.name
* @param {string} data.description
* *
* @param {StripePriceInput[]=} data.stripe_prices * @param {StripePriceInput[]=} data.stripe_prices
* *
@ -159,7 +162,8 @@ class ProductRepository {
**/ **/
async update(data, options) { async update(data, options) {
const productData = { const productData = {
name: data.name name: data.name,
description: data.description
}; };
const product = await this._Product.edit(productData, { const product = await this._Product.edit(productData, {
@ -206,6 +210,7 @@ class ProductRepository {
stripe_product_id: stripeProduct.get('stripe_product_id'), stripe_product_id: stripeProduct.get('stripe_product_id'),
active: existingPrice.active, active: existingPrice.active,
nickname: existingPrice.nickname, nickname: existingPrice.nickname,
description: existingPrice.description,
currency: existingPrice.currency, currency: existingPrice.currency,
amount: existingPrice.amount, amount: existingPrice.amount,
type: existingPrice.type, type: existingPrice.type,
@ -213,7 +218,8 @@ class ProductRepository {
}, options); }, options);
} else { } else {
await this._StripePrice.edit({ await this._StripePrice.edit({
nickname: existingPrice.nickname nickname: existingPrice.nickname,
description: existingPrice.description
}, { }, {
...options, ...options,
id: stripePrice.id id: stripePrice.id
@ -241,6 +247,7 @@ class ProductRepository {
stripe_product_id: stripeProduct.get('stripe_product_id'), stripe_product_id: stripeProduct.get('stripe_product_id'),
active: price.active, active: price.active,
nickname: price.nickname, nickname: price.nickname,
description: newPrice.description,
currency: price.currency, currency: price.currency,
amount: price.unit_amount, amount: price.unit_amount,
type: price.type, type: price.type,