fix: rm licence
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m42s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m42s
This commit is contained in:
@@ -2,8 +2,17 @@ package fr.titionfire.ffsaf.data.repository;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.CheckoutModel;
|
||||
import io.quarkus.hibernate.reactive.panache.PanacheRepositoryBase;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
@ApplicationScoped
|
||||
public class CheckoutRepository implements PanacheRepositoryBase<CheckoutModel, Long> {
|
||||
|
||||
public Uni<Long> countByLicenseId(long id) {
|
||||
return getSession()
|
||||
.chain(s -> s
|
||||
.createNativeQuery("SELECT COUNT(*) FROM ffsaf__checkout WHERE ?1 = ANY(license_ids)", Long.class)
|
||||
.setParameter(1, id)
|
||||
.getSingleResult());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class CheckoutService {
|
||||
String organizationSlug;
|
||||
|
||||
public Uni<Boolean> canDeleteLicence(long id) {
|
||||
return repository.find("?1 IN licenseIds", id).count().map(count -> count == 0);
|
||||
return repository.countByLicenseId(id).invoke(c -> System.out.println(c)).map(count -> count == 0);
|
||||
}
|
||||
|
||||
public Uni<String> create(List<Long> ids, SecurityCtx securityCtx) {
|
||||
|
||||
Reference in New Issue
Block a user