Skip to content
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

vinciusfcf = Quarkus + Postgres #15

Closed
wants to merge 12 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
final
viniciusfcf committed Feb 6, 2024
commit 119e72c6bc83842a0d881012cf879745988325d8
Original file line number Diff line number Diff line change
@@ -56,7 +56,8 @@ public Response debitarCreditar(@PathParam("id") Integer id, TransacaoEntrada te
@GET
@Path("/{id}/extrato")
@Produces(MediaType.APPLICATION_JSON)
public Response extrato(@PathParam("id") Integer id) {
public Response extrato(@PathParam("id") Integer id,
@QueryParam("sleep1") boolean sleep1) throws InterruptedException {
if (!existeCliente(id)) {
return Response.status(404).build();
}
@@ -72,7 +73,9 @@ public Response extrato(@PathParam("id") Integer id) {
extrato.saldo.total = saldoCliente.saldo;
extrato.saldo.limite = saldoCliente.limite;
}

if (sleep1) {
Thread.sleep(10000);
}
return Response.ok().entity(extrato).build();
}

Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
import io.quarkus.runtime.annotations.RegisterForReflection;
@@ -32,8 +33,10 @@ public class Transacao extends PanacheEntityBase {
@JsonFormat(pattern = "yyyy-MM-dd'T'hh:mm:ss.SSS'Z'")
public LocalDateTime realizada_em;

@JsonIgnore
public int saldo;

@JsonIgnore
public int limite;

public static Transacao of(TransacaoEntrada te) {
Original file line number Diff line number Diff line change
@@ -7,4 +7,5 @@ quarkus.hibernate-orm.sql-load-script=import.sql
quarkus.datasource.jdbc.max-size=5
quarkus.swagger-ui.always-include=true
quarkus.datasource.jdbc.min-size=5
quarkus.datasource.jdbc.initial-size=5
quarkus.datasource.devservices.port=5432