Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move deps custom func to options as toDeps #220

Open
github-actions bot opened this issue Feb 21, 2021 · 0 comments
Open

move deps custom func to options as toDeps #220

github-actions bot opened this issue Feb 21, 2021 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Feb 21, 2021

move deps custom func to options as toDeps

// TODO: move deps custom func to options as toDeps

const DEFAULT_OPTIONS = {
  toParams: () => ({}),
  toContext: (req) => {
    const context = req && req.session ? req.session.context : {}
    const traceID = req.id

    return {
      ...context,
      traceID,
    }
  } ,
  toResult: toResult_,
  toError: toError_
}

const DEFAULT_DEPS = {
  log: new MockLogger(),
  createValidator: createValidator_,
  createUseCase: createUseCase_,
  // TODO: move deps custom func to options as toDeps
  provideUseCaseDeps: () => {}
}

/**
 * Returns function with encapsulated use case, ready to run with proper params
 * @params {ObjectConstructor} - class for particular use case, should be a UseCase or it's subclass

0e40321437aee910b8d2ce435d9cd84577b57ef7

It's better to go even futher

extend options with

toTraceOptions: ()=> {}
// and 
toDeps: ()=> {} 

@github-actions github-actions bot added the todo label Feb 21, 2021
@nesterone nesterone added infra tech-debt Technical debt labels Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant