-
Notifications
You must be signed in to change notification settings - Fork 22
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
Usecase as step #89
Labels
enhancement
New feature or request
Comments
Suggested code: 'Save the User': usecaseStep(saveUser, {
user: (ctx) => ctx.user, // optional, with the default value of ctx.user
request: (ctx) => ({
// optional, with the default values comming from the context
// - read all the request metadata from the use case
// - try to find the expected fields in the context
// or, in case of a custom request, you can define the request as below
name: ctx..name1,
email: ctx.email2,
password: ctx.password3,
}),
response: (ret) => ({
// optional, with the default value of ret
// once the use case is executed, the response is returned
// and merged with the context
// for example, the user id can be returned and used in the next step
userId: ret.id,
// this is the same as:
// ctx.saveUser.userId = ret.id
// I think it is important to have a isolation variable with the name of the use case (saveUser)
}),
}), I'm still not sure if the function name |
I believe that a use case can be passed as a variable, so I agree with your sugestion And also a basic validation to check if that |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
Today, it is very common to nest usecases to resolve a complete application flow.
When we call one usecase inside another, we end up calling it as a method and not natively as a usecase step.
This functionality will help to have a cleaner code, more metadata about the use of nested use cases, in addition to opening up possibilities to have an even richer audit trail
The text was updated successfully, but these errors were encountered: