Refactored storagePath parameter

refs https://github.com/TryGhost/Team/issues/916

-  The refactor was done follow the DI Constructor pattern with single options Object parameter
- It didn't make sense to have a "config" object inside of options object containing just one property
This commit is contained in:
Naz 2021-07-20 19:35:49 +04:00 committed by naz
parent 2472695535
commit 19c5c0b05a
2 changed files with 4 additions and 7 deletions

View File

@ -15,8 +15,7 @@ const messages = {
module.exports = class MembersCSVImporter {
/**
* @param {Object} options
* @param {Object} options.config
* @param {string} options.config.storagePath - The path to store CSV's in before importing
* @param {string} options.storagePath - The path to store CSV's in before importing
* @param {Object} options.settingsCache - An instance of the Ghost Settings Cache
* @param {() => Object} options.getMembersApi
* @param {Object} options.ghostMailer - An instance of GhostMailer
@ -25,8 +24,8 @@ module.exports = class MembersCSVImporter {
* @param {Object} options.knex - An instance of the Ghost Database connection
* @param {Function} options.urlFor - function generating urls
*/
constructor({config, settingsCache, getMembersApi, ghostMailer, isSet, addJob, knex, urlFor}) {
this._storagePath = config.storagePath;
constructor({storagePath, settingsCache, getMembersApi, ghostMailer, isSet, addJob, knex, urlFor}) {
this._storagePath = storagePath;
this._settingsCache = settingsCache;
this._getMembersApi = getMembersApi;
this._ghostMailer = ghostMailer;

View File

@ -128,9 +128,7 @@ const membersService = {
stripeConnect: require('./stripe-connect'),
importer: new MembersCSVImporter({
config: {
storagePath: config.getContentPath('data')
},
storagePath: config.getContentPath('data'),
settingsCache,
getMembersApi: () => membersApi,
ghostMailer,