0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Updated options parameter to be optional

no-issue

Since updating the product repository to force transactions, the options
parameter was used in every call, meaning it wasn't optional any more,
which broke usage. This updates the parameter to have a default so that
existing usage still works.
This commit is contained in:
Fabien O'Carroll 2021-09-06 12:47:19 +02:00
parent 537c9cb02d
commit 66143dbb7c

View file

@ -48,7 +48,7 @@ class ProductRepository {
* *
* @returns {Promise<ProductModel>} * @returns {Promise<ProductModel>}
*/ */
async get(data, options) { async get(data, options = {}) {
if (!options.transacting) { if (!options.transacting) {
return this._Product.transaction((transacting) => { return this._Product.transaction((transacting) => {
return this.get(data, { return this.get(data, {
@ -115,7 +115,7 @@ class ProductRepository {
* *
* @returns {Promise<ProductModel>} * @returns {Promise<ProductModel>}
**/ **/
async create(data, options) { async create(data, options = {}) {
if (!this._stripeAPIService.configured && (data.stripe_prices || data.monthly_price || data.yearly_price)) { if (!this._stripeAPIService.configured && (data.stripe_prices || data.monthly_price || data.yearly_price)) {
throw new UpdateCollisionError({ throw new UpdateCollisionError({
message: 'The requested functionality requires Stripe to be configured. See https://ghost.org/integrations/stripe/', message: 'The requested functionality requires Stripe to be configured. See https://ghost.org/integrations/stripe/',
@ -250,7 +250,7 @@ class ProductRepository {
* *
* @returns {Promise<ProductModel>} * @returns {Promise<ProductModel>}
**/ **/
async update(data, options) { async update(data, options = {}) {
if (!this._stripeAPIService.configured && (data.stripe_prices || data.monthly_price || data.yearly_price)) { if (!this._stripeAPIService.configured && (data.stripe_prices || data.monthly_price || data.yearly_price)) {
throw new UpdateCollisionError({ throw new UpdateCollisionError({
message: 'The requested functionality requires Stripe to be configured. See https://ghost.org/integrations/stripe/', message: 'The requested functionality requires Stripe to be configured. See https://ghost.org/integrations/stripe/',
@ -489,7 +489,7 @@ class ProductRepository {
* *
* @returns {Promise<{data: ProductModel[], meta: object}>} * @returns {Promise<{data: ProductModel[], meta: object}>}
**/ **/
async list(options) { async list(options = {}) {
if (!options.transacting) { if (!options.transacting) {
return this._Product.transaction((transacting) => { return this._Product.transaction((transacting) => {
return this.list({ return this.list({