mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Exposed OfferRepository from OffersModule
refs https://github.com/TryGhost/Team/issues/1090 When creating checkout session we will need to be able to look up Offers from the OfferRepository. This exposes the repository so that it can be passed as a dependency elsewhere.
This commit is contained in:
parent
371581f677
commit
d57d082c39
@ -7,9 +7,11 @@ class OffersModule {
|
||||
/**
|
||||
* @param {OffersAPI} offersAPI
|
||||
* @param {import('@tryghost/express-dynamic-redirects')} redirectManager
|
||||
* @param {OfferRepository} repository
|
||||
*/
|
||||
constructor(offersAPI, redirectManager) {
|
||||
constructor(offersAPI, redirectManager, repository) {
|
||||
this.api = offersAPI;
|
||||
this.repository = repository;
|
||||
this.redirectManager = redirectManager;
|
||||
}
|
||||
|
||||
@ -52,7 +54,7 @@ class OffersModule {
|
||||
static create(deps) {
|
||||
const repository = new OfferRepository(deps.OfferModel, deps.stripeAPIService);
|
||||
const offersAPI = new OffersAPI(repository);
|
||||
return new OffersModule(offersAPI, deps.redirectManager);
|
||||
return new OffersModule(offersAPI, deps.redirectManager, repository);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,15 +33,12 @@ class OfferRepository {
|
||||
/**
|
||||
* @param {{forge: (data: object) => import('bookshelf').Model<Offer.OfferProps>}} OfferModel
|
||||
* @param {import('@tryghost/members-stripe-service')} stripeAPIService
|
||||
* @param {import('@tryghost/express-dynamic-redirects')} redirectManager
|
||||
*/
|
||||
constructor(OfferModel, stripeAPIService, redirectManager) {
|
||||
constructor(OfferModel, stripeAPIService) {
|
||||
/** @private */
|
||||
this.OfferModel = OfferModel;
|
||||
/** @private */
|
||||
this.stripeAPIService = stripeAPIService;
|
||||
/** @private */
|
||||
this.redirectManager = redirectManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user