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

Make orderOptions.generateOrderCode injectable #452

Closed
michaelbromley opened this issue Aug 31, 2020 · 0 comments
Closed

Make orderOptions.generateOrderCode injectable #452

michaelbromley opened this issue Aug 31, 2020 · 0 comments
Milestone

Comments

@michaelbromley
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently you can define a custom function to generate order codes. One problem is that there is no check done to see if that code is unique, and there is no way to easily check this in the function itself because it is not injectable.

Describe the solution you'd like
Rather than the current function:

generateOrderCode?: (ctx: RequestContext) => string | Promise<string>;

we should accept an object which implements the InjectableStrategy interface which will allows the function itself to check for uniqueness.

@michaelbromley michaelbromley added this to the v0.16.0 milestone Aug 31, 2020
michaelbromley added a commit that referenced this issue Oct 7, 2020
Closes #452

BREAKING CHANGE: The `orderOptions.generateOrderCode` config option has been replaced with `orderOptions.orderCodeStrategy`. This change allows order code generation to take advantage of the `InjectableStrategy` interface, i.e. to be able to inject Vendure services and other providers (e.g. the database connection). See the `OrderCodeStrategy` documentation for guidance on how to use the new API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant