-
Notifications
You must be signed in to change notification settings - Fork 222
Part four query bus #66
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
Conversation
Co-authored-by: Rubén Salado <rsaladocid@users.noreply.github.com> Co-authored-by: Iván Portillo <ivanportillo@me.com>
Co-authored-by: aliondev <antonioleon@audiense.com> Co-authored-by: Rubén Salado <rsaladocid@users.noreply.github.com>
Co-authored-by: aliondev <antonioleon@audiense.com> Co-authored-by: Rubén Salado <rsaladocid@users.noreply.github.com>
Part four command bus
Co-authored-by: aliondev <antonioleon@audiense.com> Co-authored-by: Rubén Salado <rsaladocid@users.noreply.github.com>
Co-authored-by: Rubén Salado <rsaladocid@users.noreply.github.com> Co-authored-by: aliondev <antonioleon@audiense.com>
Co-authored-by: Rubén Salado <rsaladocid@users.noreply.github.com> Co-authored-by: aliondev <antonioleon@audiense.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌🙌🙌
export interface CommandHandler<T extends Command> { | ||
subscribedTo(): Command; | ||
handle(command: T): Promise<void>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍😊
|
||
export interface CommandBus { | ||
dispatch(command: Command): Promise<void>; | ||
} No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about enabling the a TSLint eofline
rule?
Also, we should add the tslint
execution to the npm test
or some other task to be executed in the project GitHub Workflow.
Do you agree? Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree, I'm going to add it
export interface QueryBus { | ||
ask<R extends Response>(query: Query): Promise<R>; | ||
} No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌👌👌
if (!queryHandler) { | ||
throw new QueryNotRegisteredError(query); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we handling these exception somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception and the CommandNotRegisteredError are handled by the controller, throwing a 500 error. Is not handled as a specific error but its a general error.
8a0359a
to
2e2c8c1
Compare
2e2c8c1
to
80cb15f
Compare
No description provided.