feat: add cache to getAssoInfo
This commit is contained in:
parent
26f56006f6
commit
cc5534ef00
@ -23,6 +23,8 @@ public class AssoEndpoints {
|
|||||||
return stateIdService.get_status(stateId).onFailure().transform(throwable -> {
|
return stateIdService.get_status(stateId).onFailure().transform(throwable -> {
|
||||||
if (throwable instanceof WebApplicationException exception) {
|
if (throwable instanceof WebApplicationException exception) {
|
||||||
if (exception.getResponse().getStatus() == 404)
|
if (exception.getResponse().getStatus() == 404)
|
||||||
|
return new DNotFoundException("Service momentanément indisponible");
|
||||||
|
if (exception.getResponse().getStatus() == 400)
|
||||||
return new DNotFoundException("Asso introuvable");
|
return new DNotFoundException("Asso introuvable");
|
||||||
}
|
}
|
||||||
return throwable;
|
return throwable;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package fr.titionfire.ffsaf.rest.client;
|
package fr.titionfire.ffsaf.rest.client;
|
||||||
|
|
||||||
import fr.titionfire.ffsaf.rest.data.AssoData;
|
import fr.titionfire.ffsaf.rest.data.AssoData;
|
||||||
|
import io.quarkus.cache.CacheResult;
|
||||||
import io.smallrye.mutiny.Uni;
|
import io.smallrye.mutiny.Uni;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
@ -13,5 +14,6 @@ public interface StateIdService {
|
|||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/structure/{id}")
|
@Path("/structure/{id}")
|
||||||
|
@CacheResult(cacheName = "AssoData_status")
|
||||||
Uni<AssoData> get_status(@PathParam("id") String id);
|
Uni<AssoData> get_status(@PathParam("id") String id);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user