-
Notifications
You must be signed in to change notification settings - Fork 91
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: soulaimanGhailan <[email protected]>
|
@@ -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.
@@ -13,6 +13,7 @@ | |||
import org.example.oracle.cqrs.common.Dtos.DebitAccountDTO; | |||
import org.example.oracle.cqrs.common.Dtos.UpdateAccountStatusDTO; | |||
import org.example.oracle.cqrs.common.events.BaseEvent; | |||
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.
@@ -37,27 +38,27 @@ public ResponseEntity createAccount(@Valid @RequestBody CreateAccountDTO request | |||
String accountId = UUID.randomUUID().toString(); | |||
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();
No description provided.