Skip to content

Commit

Permalink
feat: return ticketId when creating enrollment
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavofg1pontes committed Sep 24, 2024
1 parent ac05e96 commit 0b6145b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface EnrollmentAPI {
@ApiResponse(responseCode = "201", description = "Enrollment created successfully"),
@ApiResponse(responseCode = "400", description = "Invalid request")
})
ResponseEntity<Void> create(@RequestBody CreateEnrollmentRequest request);
ResponseEntity<String> create(@RequestBody CreateEnrollmentRequest request);

@GetMapping(value = "/list", produces = "application/json")
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class EnrollmentController implements EnrollmentAPI {
private final EnrollmentService enrollmentService;

@Override
public ResponseEntity<Void> create(CreateEnrollmentRequest request) {
public ResponseEntity<String> create(CreateEnrollmentRequest request) {
final UserJpaEntity authenticatedUser = (UserJpaEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
final CreateEnrollmentInput input = CreateEnrollmentInput.of(
authenticatedUser.toAggregate(),
Expand All @@ -36,7 +36,7 @@ public ResponseEntity<Void> create(CreateEnrollmentRequest request) {
);
final CreateEnrollmentOutput out = this.enrollmentService.create(input);

return ResponseEntity.created(URI.create("/v1/enrollment/" + out.enrollmentId())).build();
return ResponseEntity.created(URI.create("/v1/enrollment/" + out.enrollmentId())).body(out.ticketId());
}

@Override
Expand Down

0 comments on commit 0b6145b

Please sign in to comment.