Skip to content

Conversation

@soulaimanGhailan
Copy link
Member

No description provided.

Signed-off-by: soulaimanGhailan <soulaiman8ghailan@gmail.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 3, 2025
@@ -1,6 +1,11 @@
package org.example.oracle.cqrs.command.commands;

import lombok.*;
Copy link
Member

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.*;
Copy link
Member

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.*;
Copy link
Member

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();
Copy link
Member

@andytael andytael Jun 12, 2025

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();

Copy link
Member Author

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>
@sonarqubecloud
Copy link

@andytael andytael merged commit 02f8471 into oracle:main Jun 16, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants