Merge branch 'dev-comp' into dev
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 10m20s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 10m20s
This commit is contained in:
@@ -186,6 +186,6 @@ public class AffiliationRequestEndpoints {
|
||||
public Uni<Response> getStatus(
|
||||
@Parameter(description = "L'identifiant de la demande d'affiliation") @PathParam("id") long id) throws URISyntaxException {
|
||||
return Utils.getMediaFile(id, media, "aff_request/status", "affiliation_request_" + id,
|
||||
Uni.createFrom().nullItem());
|
||||
Uni.createFrom().nullItem(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ public class ClubEndpoints {
|
||||
@Parameter(description = "Identifiant long (clubId) de club") @PathParam("clubId") String clubId) {
|
||||
return clubService.getByClubId(clubId).chain(Unchecked.function(clubModel -> {
|
||||
try {
|
||||
return Utils.getMediaFile((clubModel != null) ? clubModel.getId() : -1, media, "ppClub",
|
||||
return Utils.getMediaFileNoDefault((clubModel != null) ? clubModel.getId() : -1, media, "ppClub",
|
||||
Uni.createFrom().nullItem());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new InternalError();
|
||||
@@ -358,7 +358,7 @@ public class ClubEndpoints {
|
||||
return clubService.getById(id).onItem().invoke(checkPerm).chain(Unchecked.function(clubModel -> {
|
||||
try {
|
||||
return Utils.getMediaFile(clubModel.getId(), media, "clubStatus",
|
||||
"statue-" + clubModel.getName(), Uni.createFrom().nullItem());
|
||||
"statue-" + clubModel.getName(), Uni.createFrom().nullItem(), false);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@@ -47,4 +47,12 @@ public class CompetitionAdminEndpoints {
|
||||
public Uni<List<CompetitionData>> getAllSystemAdmin(@PathParam("system") CompetitionSystem system) {
|
||||
return service.getAllSystemAdmin(securityCtx, system);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("all/{system}/table")
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<CompetitionData>> getAllSystemTable(@PathParam("system") CompetitionSystem system) {
|
||||
return service.getAllSystemTable(securityCtx, system);
|
||||
}
|
||||
}
|
||||
|
||||
48
src/main/java/fr/titionfire/ffsaf/rest/ResultEndpoints.java
Normal file
48
src/main/java/fr/titionfire/ffsaf/rest/ResultEndpoints.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package fr.titionfire.ffsaf.rest;
|
||||
|
||||
import fr.titionfire.ffsaf.domain.service.ResultService;
|
||||
import fr.titionfire.ffsaf.rest.data.ResultCategoryData;
|
||||
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.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}")
|
||||
public Uni<List<ResultCategoryData>> getCategory(@PathParam("uuid") String uuid) {
|
||||
return resultService.getCategory(uuid, securityCtx);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("{uuid}/club")
|
||||
public Uni<ResultService.ClubArrayData> getClub(@PathParam("uuid") String uuid) {
|
||||
return resultService.getClubArray(uuid, securityCtx);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("{uuid}/comb")
|
||||
public Uni<ResultService.CombsArrayData> getComb(@PathParam("uuid") String uuid) {
|
||||
return resultService.getAllCombArray(uuid, securityCtx);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.CompetitionGuestModel;
|
||||
import fr.titionfire.ffsaf.data.model.CompetitionModel;
|
||||
import fr.titionfire.ffsaf.data.model.RegisterModel;
|
||||
import fr.titionfire.ffsaf.utils.Categorie;
|
||||
@@ -11,6 +12,7 @@ import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@@ -57,9 +59,9 @@ public class CompetitionData {
|
||||
model.getAdresse(), "", model.getDate(), model.getTodate(), null,
|
||||
model.getRegisterMode(), model.getStartRegister(), model.getEndRegister(), model.isPublicVisible(),
|
||||
null, model.getClub().getName(), "", null, false,
|
||||
"","", "","");
|
||||
"", "", "", "");
|
||||
|
||||
if (model.getRegisterMode() == RegisterMode.HELLOASSO){
|
||||
if (model.getRegisterMode() == RegisterMode.HELLOASSO) {
|
||||
out.setData1(model.getData1());
|
||||
out.setData2(model.getData2());
|
||||
}
|
||||
@@ -67,10 +69,15 @@ public class CompetitionData {
|
||||
return out;
|
||||
}
|
||||
|
||||
public CompetitionData addInsc(List<RegisterModel> insc) {
|
||||
this.registers = insc.stream()
|
||||
.map(i -> new SimpleRegister(i.getMembre().getId(), i.getOverCategory(), i.getWeight(),
|
||||
i.getCategorie(), (i.getClub() == null) ? null : i.getClub().getId())).toList();
|
||||
public CompetitionData addInsc(List<RegisterModel> insc, List<CompetitionGuestModel> guests) {
|
||||
this.registers = Stream.concat(
|
||||
insc.stream()
|
||||
.map(i -> new SimpleRegister(i.getMembre().getId(), i.getOverCategory(), i.getWeight(),
|
||||
i.getCategorie(), (i.getClub() == null) ? null : i.getClub().getId(),
|
||||
(i.getClub() == null) ? null : i.getClub().getName())),
|
||||
guests.stream()
|
||||
.map(i -> new SimpleRegister(i.getId() * -1, 0, i.getWeight(),
|
||||
i.getCategorie(), null, i.getClub()))).toList();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -83,5 +90,6 @@ public class CompetitionData {
|
||||
Integer weight;
|
||||
Categorie categorie;
|
||||
Long club;
|
||||
String club_str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,10 @@ public class MatchData {
|
||||
return null;
|
||||
|
||||
return new MatchData(model.getSystemId(),
|
||||
(model.getC1_id() == null) ? null : model.getC1_id().getId(), model.getC1_str(),
|
||||
(model.getC2_id() == null) ? null : model.getC2_id().getId(), model.getC2_str(),
|
||||
(model.getC1_id() == null) ? null : model.getC1_id().getId(),
|
||||
(model.getC1_guest() == null) ? null : model.getC1_guest().getName(),
|
||||
(model.getC2_id() == null) ? null : model.getC2_id().getId(),
|
||||
(model.getC2_guest() == null) ? null : model.getC2_guest().getName(),
|
||||
model.getCategory().getId(), model.getCategory_ord(), model.isEnd(), model.getPoule(),
|
||||
model.getScores());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.utils.Categorie;
|
||||
import fr.titionfire.ffsaf.utils.Genre;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -17,4 +19,11 @@ public class RegisterRequestData {
|
||||
private Integer weight;
|
||||
private int overCategory;
|
||||
private boolean lockEdit = false;
|
||||
|
||||
// for guest registration only
|
||||
private Long id = null;
|
||||
private Categorie categorie = Categorie.CADET;
|
||||
private Genre genre = Genre.NA;
|
||||
private String club = null;
|
||||
private String country = null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.MatchModel;
|
||||
import fr.titionfire.ffsaf.utils.ScoreEmbeddable;
|
||||
import fr.titionfire.ffsaf.utils.TreeNode;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class ResultCategoryData {
|
||||
int type;
|
||||
String name;
|
||||
HashMap<Character, List<PouleArrayData>> matchs = new HashMap<>();
|
||||
HashMap<Character, List<RankArray>> rankArray = new HashMap<>();
|
||||
ArrayList<TreeNode<TreeData>> trees;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public static class RankArray {
|
||||
int rank;
|
||||
String name;
|
||||
int win;
|
||||
int pointMake;
|
||||
int pointTake;
|
||||
float pointRate;
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
public record PouleArrayData(String red, boolean red_w, List<Integer[]> score, boolean blue_w, String blue, boolean end) {
|
||||
public static PouleArrayData fromModel(MatchModel matchModel) {
|
||||
return new PouleArrayData(
|
||||
matchModel.getC1Name(),
|
||||
matchModel.isEnd() && matchModel.win() > 0,
|
||||
matchModel.isEnd() ?
|
||||
matchModel.getScores().stream().map(s -> new Integer[]{s.getS1(), s.getS2()}).toList()
|
||||
: new ArrayList<>(),
|
||||
matchModel.isEnd() && matchModel.win() < 0,
|
||||
matchModel.getC2Name(),
|
||||
matchModel.isEnd());
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
public static record TreeData(long id, String c1FullName, String c2FullName, List<ScoreEmbeddable> scores,
|
||||
boolean end) {
|
||||
public static TreeData from(MatchModel match) {
|
||||
return new TreeData(match.getId(), match.getC1Name(), match.getC2Name(), match.getScores(), match.isEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.CompetitionGuestModel;
|
||||
import fr.titionfire.ffsaf.data.model.LicenceModel;
|
||||
import fr.titionfire.ffsaf.data.model.MembreModel;
|
||||
import fr.titionfire.ffsaf.data.model.RegisterModel;
|
||||
import fr.titionfire.ffsaf.net2.data.SimpleClubModel;
|
||||
import fr.titionfire.ffsaf.utils.Categorie;
|
||||
import fr.titionfire.ffsaf.utils.Genre;
|
||||
import fr.titionfire.ffsaf.utils.Utils;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -18,8 +21,9 @@ public class SimpleRegisterComb {
|
||||
private long id;
|
||||
private String fname;
|
||||
private String lname;
|
||||
private String genre;
|
||||
private String categorie;
|
||||
private Genre genre;
|
||||
private String country;
|
||||
private Categorie categorie;
|
||||
private SimpleClubModel club;
|
||||
private Integer licence;
|
||||
private Integer weight;
|
||||
@@ -30,11 +34,18 @@ public class SimpleRegisterComb {
|
||||
public static SimpleRegisterComb fromModel(RegisterModel register, List<LicenceModel> licences) {
|
||||
MembreModel membreModel = register.getMembre();
|
||||
return new SimpleRegisterComb(membreModel.getId(), membreModel.getFname(), membreModel.getLname(),
|
||||
membreModel.getGenre().name(),
|
||||
(register.getCategorie() == null) ? "Catégorie inconnue" : register.getCategorie().getName(),
|
||||
membreModel.getGenre(), membreModel.getCountry(),
|
||||
(register.getCategorie() == null) ? null : register.getCategorie(),
|
||||
SimpleClubModel.fromModel(register.getClub()), membreModel.getLicence(), register.getWeight(),
|
||||
register.getOverCategory(),
|
||||
licences.stream().anyMatch(l -> l.isValidate() && l.getSaison() == Utils.getSaison()),
|
||||
register.isLockEdit());
|
||||
}
|
||||
|
||||
public static SimpleRegisterComb fromModel(CompetitionGuestModel guest) {
|
||||
return new SimpleRegisterComb(guest.getId() * -1, guest.getFname(), guest.getLname(),
|
||||
guest.getGenre(), guest.getCountry(), guest.getCategorie(),
|
||||
new SimpleClubModel(null, guest.getClub(), "fr", null),
|
||||
null, guest.getWeight(), 0, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user