75 lines
2.2 KiB
Java
75 lines
2.2 KiB
Java
package fr.titionfire.ffsaf.rest;
|
|
|
|
import fr.titionfire.ffsaf.domain.service.ResultService;
|
|
import fr.titionfire.ffsaf.rest.data.ResultCategoryData;
|
|
import fr.titionfire.ffsaf.utils.ResultPrivacy;
|
|
import fr.titionfire.ffsaf.utils.SecurityCtx;
|
|
import io.quarkus.security.Authenticated;
|
|
import io.smallrye.mutiny.Uni;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.ws.rs.GET;
|
|
import jakarta.ws.rs.Path;
|
|
import jakarta.ws.rs.PathParam;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
|
|
@Authenticated
|
|
@Path("api/result")
|
|
public class ResultEndpoints {
|
|
|
|
@Inject
|
|
ResultService resultService;
|
|
|
|
@Inject
|
|
SecurityCtx securityCtx;
|
|
|
|
@GET
|
|
@Path("list")
|
|
public Uni<List<Object[]>> getList() {
|
|
return resultService.getList(securityCtx);
|
|
}
|
|
|
|
@GET
|
|
@Path("{uuid}/category/list")
|
|
public Uni<HashMap<String, Long>> getCategoryList(@PathParam("uuid") String uuid) {
|
|
return resultService.getCategoryList(uuid);
|
|
}
|
|
|
|
@GET
|
|
@Path("{uuid}/category/{id}")
|
|
public Uni<ResultCategoryData> getCategory(@PathParam("uuid") String uuid, @PathParam("id") long id) {
|
|
return resultService.getCategory(uuid, id, securityCtx);
|
|
}
|
|
|
|
@GET
|
|
@Path("{uuid}/club/list")
|
|
public Uni<HashMap<String, Long>> getClubList(@PathParam("uuid") String uuid) {
|
|
return resultService.getClubList(uuid);
|
|
}
|
|
|
|
@GET
|
|
@Path("{uuid}/club/{id}")
|
|
public Uni<ResultService.ClubArrayData> getClub(@PathParam("uuid") String uuid, @PathParam("id") long id) {
|
|
return resultService.getClubArray(uuid, id, securityCtx);
|
|
}
|
|
|
|
@GET
|
|
@Path("{uuid}/comb/list")
|
|
public Uni<HashMap<String, String>> getCombList(@PathParam("uuid") String uuid) {
|
|
return resultService.getCombList(uuid, ResultPrivacy.REGISTERED_ONLY);
|
|
}
|
|
|
|
@GET
|
|
@Path("{uuid}/comb/{id}")
|
|
public Uni<?> getCombList(@PathParam("uuid") String uuid, @PathParam("id") String id) {
|
|
return resultService.getCombArrayPublic(uuid, id, ResultPrivacy.REGISTERED_ONLY);
|
|
}
|
|
|
|
@GET
|
|
@Path("{uuid}/comb")
|
|
public Uni<ResultService.CombsArrayData> getComb(@PathParam("uuid") String uuid) {
|
|
return resultService.getAllCombArray(uuid, securityCtx);
|
|
}
|
|
}
|