-
Notifications
You must be signed in to change notification settings - Fork 94
FIX 2 : handling commands, type switch removal #1064
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
Signed-off-by: soulaimanGhailan <soulaiman8ghailan@gmail.com>
| @@ -1,6 +1,11 @@ | |||
| package org.example.oracle.cqrs.command.commands; | |||
|
|
|||
| import lombok.*; | |||
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.
Don't use *, use the specific imports.
| @@ -1,6 +1,10 @@ | |||
| package org.example.oracle.cqrs.command.commands; | |||
|
|
|||
| import lombok.*; | |||
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.
Don't use *, use the specific imports.
| import org.springframework.http.HttpHeaders; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; |
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.
Don't use *, use the specific imports.
| commandsProducer.enqueue(new CreateAccountCommand(UUID.randomUUID().toString(), request.getInitialBalance(), request.getCurrency(), accountId)); | ||
|
|
||
| return ResponseEntity.status(HttpStatus.ACCEPTED).header("Location", "/api/queries/status/" + accountId).build(); | ||
| return ResponseEntity.status(HttpStatus.ACCEPTED).header(HttpHeaders.LOCATION, "/api/queries/status/" + accountId).build(); |
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.
I don't think this should be hardcoded /api/queries/status/ maybe use something like this, just an example:
URI location = ServletUriComponentsBuilder
.fromCurrentRequest()
.path("/{accountId}")
.buildAndExpand(newCustomer.getCustomerId())
.toUri();
return ResponseEntity.created(location).build();
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.
Thanks for your note you're right, it shouldn't be hardcoded, the query part of the application is meant to be scaled out as a separate service, so I'm now fetching the query basedUrl from the context as environment variable and building it as mentioned
Signed-off-by: soulaimanGhailan <soulaiman8ghailan@gmail.com>
Signed-off-by: soulaimanGhailan <soulaiman8ghailan@gmail.com>
|



No description provided.