Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
CHANGED: config and added debug messsages
Browse files Browse the repository at this point in the history
  • Loading branch information
AleixMT committed Jan 29, 2024
1 parent 835d2ed commit 6106c4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* todo añadir loans
*/
@RestController
@Profile("dev")
@Profile("prod")
public class BuscadorForwarderController {

private final BuscadorClient buscadorClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,18 @@ public LoanResponse createLoan(LoanRequest request) {
throw new EntityNotFoundException("Book id " + loan.getBookId() + " does not exist.", null);
}

Logger.getGlobal().warning("hasta aki existe book");
// If loan referencing non-existing clients throw 404
if(! isExistingClient(loan.getClientId().toString()))
{
throw new EntityNotFoundException("Client id " + loan.getClientId() + " does not exist.", null);
}

Logger.getGlobal().warning("hasta aki existe client");

// Implicit else: valid loan is saved in the DB
Loan createdLoan = loanRepository.save(loan);
Logger.getGlobal().warning("hasta aki ya se ha guardao");
return this.loanToLoanResponseConverter.convert(createdLoan);
}

Expand Down

0 comments on commit 6106c4c

Please sign in to comment.