feat: add checkout table auto clean + disable pay button for pre deployment test
This commit is contained in:
parent
15f65b1014
commit
1e37c43dcd
@ -13,6 +13,7 @@ import fr.titionfire.ffsaf.utils.SecurityCtx;
|
|||||||
import fr.titionfire.ffsaf.utils.Utils;
|
import fr.titionfire.ffsaf.utils.Utils;
|
||||||
import io.quarkus.hibernate.reactive.panache.Panache;
|
import io.quarkus.hibernate.reactive.panache.Panache;
|
||||||
import io.quarkus.hibernate.reactive.panache.common.WithSession;
|
import io.quarkus.hibernate.reactive.panache.common.WithSession;
|
||||||
|
import io.quarkus.scheduler.Scheduled;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
import jakarta.enterprise.context.ApplicationScoped;
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
@ -21,6 +22,8 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
|
|||||||
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||||
import org.hibernate.reactive.mutiny.Mutiny;
|
import org.hibernate.reactive.mutiny.Mutiny;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@WithSession
|
@WithSession
|
||||||
@ -158,4 +161,15 @@ public class CheckoutService {
|
|||||||
.onFailure().invoke(Throwable::printStackTrace)
|
.onFailure().invoke(Throwable::printStackTrace)
|
||||||
.map(__ -> Response.ok().build());
|
.map(__ -> Response.ok().build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
|
Uni<Void> everyHours() {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.HOUR, -1);
|
||||||
|
Date dateLimit = calendar.getTime();
|
||||||
|
|
||||||
|
return repository.delete("creationDate < ?1 AND (checkoutId IS NULL OR paymentStatus = ?2)", dateLimit,
|
||||||
|
CheckoutModel.PaymentStatus.UNKNOW)
|
||||||
|
.map(__ -> null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export function MemberList({source}) {
|
|||||||
{source === "admin" &&
|
{source === "admin" &&
|
||||||
<button className="btn btn-primary" onClick={() => navigate("validate")} style={{marginTop: "0.5rem"}}>Valider des
|
<button className="btn btn-primary" onClick={() => navigate("validate")} style={{marginTop: "0.5rem"}}>Valider des
|
||||||
licences</button>}
|
licences</button>}
|
||||||
{source === "club" &&
|
{source === "club" && false && // TODO: enable when payment is ready
|
||||||
<button className="btn btn-primary" onClick={() => navigate("pay")} style={{marginTop: "0.5rem"}}>Paiement des
|
<button className="btn btn-primary" onClick={() => navigate("pay")} style={{marginTop: "0.5rem"}}>Paiement des
|
||||||
licences</button>}
|
licences</button>}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user