Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soulaimanGhailan
Copy link
Member

No description provided.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 3, 2025
Copy link

sonarqubecloud bot commented 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.

@@ -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.*;
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.

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

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