feat: rework competition perm, naming, competition data
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 10m6s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 10m6s
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package fr.titionfire.ffsaf.rest;
|
||||
|
||||
import fr.titionfire.ffsaf.domain.service.PouleService;
|
||||
import fr.titionfire.ffsaf.rest.data.PouleData;
|
||||
import fr.titionfire.ffsaf.rest.data.PouleFullData;
|
||||
import fr.titionfire.ffsaf.domain.service.CategoryService;
|
||||
import fr.titionfire.ffsaf.rest.data.CategoryData;
|
||||
import fr.titionfire.ffsaf.rest.data.CategoryFullData;
|
||||
import fr.titionfire.ffsaf.utils.CompetitionSystem;
|
||||
import fr.titionfire.ffsaf.utils.SecurityCtx;
|
||||
import io.quarkus.security.Authenticated;
|
||||
@@ -14,14 +14,14 @@ import jakarta.ws.rs.core.MediaType;
|
||||
import java.util.List;
|
||||
|
||||
@Authenticated
|
||||
@Path("api/poule/{system}/")
|
||||
public class PouleEndpoints {
|
||||
@Path("api/poule/{system}/admin/")
|
||||
public class CategoryAdminEndpoints {
|
||||
|
||||
@PathParam("system")
|
||||
private CompetitionSystem system;
|
||||
|
||||
@Inject
|
||||
PouleService service;
|
||||
CategoryService service;
|
||||
|
||||
@Inject
|
||||
SecurityCtx securityCtx;
|
||||
@@ -30,28 +30,28 @@ public class PouleEndpoints {
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<PouleData> getById(@PathParam("id") Long id) {
|
||||
return service.getById(securityCtx, system, id);
|
||||
public Uni<CategoryData> getByIdAdmin(@PathParam("id") Long id) {
|
||||
return service.getByIdAdmin(securityCtx, system, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<PouleData>> getAll() {
|
||||
return service.getAll(securityCtx, system);
|
||||
public Uni<List<CategoryData>> getAllAdmin() {
|
||||
return service.getAllAdmin(securityCtx, system);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<PouleData> addOrUpdate(PouleData data) {
|
||||
public Uni<CategoryData> addOrUpdate(CategoryData data) {
|
||||
return service.addOrUpdate(securityCtx, system, data);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("sync")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Uni<?> syncPoule(PouleFullData data) {
|
||||
return service.syncPoule(securityCtx, system, data);
|
||||
public Uni<?> syncCategory(CategoryFullData data) {
|
||||
return service.syncCategory(securityCtx, system, data);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@@ -0,0 +1,50 @@
|
||||
package fr.titionfire.ffsaf.rest;
|
||||
|
||||
import fr.titionfire.ffsaf.domain.service.CompetitionService;
|
||||
import fr.titionfire.ffsaf.rest.data.CompetitionData;
|
||||
import fr.titionfire.ffsaf.utils.CompetitionSystem;
|
||||
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 jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Path("api/competition/admin")
|
||||
public class CompetitionAdminEndpoints {
|
||||
|
||||
@Inject
|
||||
CompetitionService service;
|
||||
|
||||
@Inject
|
||||
SecurityCtx securityCtx;
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<CompetitionData> getByIdAdmin(@PathParam("id") Long id) {
|
||||
return service.getByIdAdmin(securityCtx, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("all")
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<CompetitionData>> getAllAdmin() {
|
||||
return service.getAllAdmin(securityCtx);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("all/{system}")
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<CompetitionData>> getAllSystemAdmin(@PathParam("system") CompetitionSystem system) {
|
||||
return service.getAllSystemAdmin(securityCtx, system);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import fr.titionfire.ffsaf.rest.data.CompetitionData;
|
||||
import fr.titionfire.ffsaf.rest.data.RegisterRequestData;
|
||||
import fr.titionfire.ffsaf.rest.data.SimpleCompetData;
|
||||
import fr.titionfire.ffsaf.rest.data.SimpleRegisterComb;
|
||||
import fr.titionfire.ffsaf.utils.CompetitionSystem;
|
||||
import fr.titionfire.ffsaf.utils.SecurityCtx;
|
||||
import io.quarkus.security.Authenticated;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
@@ -29,8 +28,11 @@ public class CompetitionEndpoints {
|
||||
@Path("{id}")
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<CompetitionData> getById(@PathParam("id") Long id) {
|
||||
return service.getById(securityCtx, id);
|
||||
public Uni<CompetitionData> getById(@PathParam("id") Long id, @QueryParam("light") boolean light) {
|
||||
if (light)
|
||||
return service.getById(securityCtx, id);
|
||||
else
|
||||
return service.getByIdAdmin(securityCtx, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -76,14 +78,6 @@ public class CompetitionEndpoints {
|
||||
return service.getAll(securityCtx);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("all/{system}")
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<CompetitionData>> getAllSystem(@PathParam("system") CompetitionSystem system) {
|
||||
return service.getAllSystem(securityCtx, system);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Authenticated
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
||||
@@ -14,8 +14,8 @@ import jakarta.ws.rs.core.MediaType;
|
||||
import java.util.List;
|
||||
|
||||
@Authenticated
|
||||
@Path("api/match/{system}/")
|
||||
public class MatchEndpoints {
|
||||
@Path("api/match/{system}/admin")
|
||||
public class MatchAdminEndpoints {
|
||||
|
||||
@PathParam("system")
|
||||
private CompetitionSystem system;
|
||||
@@ -30,15 +30,15 @@ public class MatchEndpoints {
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<MatchData> getById(@PathParam("id") Long id) {
|
||||
return service.getById(securityCtx, system, id);
|
||||
public Uni<MatchData> getByIdAdmin(@PathParam("id") Long id) {
|
||||
return service.getByIdAdmin(securityCtx, system, id);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("getAllByPoule/{id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<MatchData>> getAllByPoule(@PathParam("id") Long id) {
|
||||
return service.getAllByPoule(securityCtx, system, id);
|
||||
public Uni<List<MatchData>> getAllByPouleAdmin(@PathParam("id") Long id) {
|
||||
return service.getAllByPouleAdmin(securityCtx, system, id);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -1,6 +1,6 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.PouleModel;
|
||||
import fr.titionfire.ffsaf.data.model.CategoryModel;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -8,16 +8,16 @@ import lombok.Data;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class PouleData {
|
||||
public class CategoryData {
|
||||
private Long id;
|
||||
private String name;
|
||||
private Long compet;
|
||||
private Integer type;
|
||||
|
||||
public static PouleData fromModel(PouleModel model) {
|
||||
public static CategoryData fromModel(CategoryModel model) {
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
return new PouleData(model.getSystemId(), model.getName(), model.getCompet().getId(), model.getType());
|
||||
return new CategoryData(model.getSystemId(), model.getName(), model.getCompet().getId(), model.getType());
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class PouleFullData {
|
||||
public class CategoryFullData {
|
||||
private Long id;
|
||||
private String name;
|
||||
private Long compet;
|
||||
@@ -1,9 +1,10 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.CompetitionModel;
|
||||
import fr.titionfire.ffsaf.data.model.RegisterModel;
|
||||
import fr.titionfire.ffsaf.utils.Categorie;
|
||||
import fr.titionfire.ffsaf.utils.CompetitionSystem;
|
||||
import fr.titionfire.ffsaf.data.model.RegisterModel;
|
||||
import fr.titionfire.ffsaf.utils.RegisterMode;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -17,20 +18,53 @@ import java.util.List;
|
||||
public class CompetitionData {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String description;
|
||||
private String adresse;
|
||||
private String uuid;
|
||||
private Date date;
|
||||
private Date toDate;
|
||||
private CompetitionSystem system;
|
||||
private RegisterMode registerMode;
|
||||
private Date startRegister;
|
||||
private Date endRegister;
|
||||
private boolean publicVisible;
|
||||
private Long club;
|
||||
private String clubName;
|
||||
private String owner;
|
||||
private List<SimpleRegister> registers;
|
||||
private boolean canEdit;
|
||||
private String data1;
|
||||
private String data2;
|
||||
private String data3;
|
||||
private String data4;
|
||||
|
||||
public static CompetitionData fromModel(CompetitionModel model) {
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
return new CompetitionData(model.getId(), model.getName(), model.getUuid(), model.getDate(), model.getSystem(),
|
||||
model.getClub().getId(), model.getClub().getName(), model.getOwner(), null);
|
||||
return new CompetitionData(model.getId(), model.getName(), model.getDescription(), model.getAdresse(),
|
||||
model.getUuid(), model.getDate(), model.getTodate(), model.getSystem(),
|
||||
model.getRegisterMode(), model.getStartRegister(), model.getEndRegister(), model.isPublicVisible(),
|
||||
model.getClub().getId(), model.getClub().getName(), model.getOwner(), null, false,
|
||||
model.getData1(), model.getData2(), model.getData3(), model.getData4());
|
||||
}
|
||||
|
||||
public static CompetitionData fromModelLight(CompetitionModel model) {
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
CompetitionData out = new CompetitionData(model.getId(), model.getName(), model.getDescription(),
|
||||
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){
|
||||
out.setData1(model.getData1());
|
||||
out.setData2(model.getData2());
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
public CompetitionData addInsc(List<RegisterModel> insc) {
|
||||
|
||||
@@ -17,10 +17,10 @@ public class MatchData {
|
||||
private String c1_str;
|
||||
private Long c2_id;
|
||||
private String c2_str;
|
||||
private Long poule;
|
||||
private long poule_ord;
|
||||
private Long category;
|
||||
private long category_ord;
|
||||
private boolean isEnd = true;
|
||||
private char groupe;
|
||||
private char poule;
|
||||
private List<ScoreEmbeddable> scores;
|
||||
|
||||
public static MatchData fromModel(MatchModel model) {
|
||||
@@ -30,7 +30,7 @@ public class MatchData {
|
||||
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.getPoule().getId(), model.getPoule_ord(), model.isEnd(), model.getGroupe(),
|
||||
model.getCategory().getId(), model.getCategory_ord(), model.isEnd(), model.getPoule(),
|
||||
model.getScores());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.Data;
|
||||
@RegisterForReflection
|
||||
public class TreeData {
|
||||
private Long id;
|
||||
private Long poule;
|
||||
private Long category;
|
||||
private Integer level;
|
||||
private Long match;
|
||||
private TreeData left;
|
||||
@@ -20,7 +20,7 @@ public class TreeData {
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
return new TreeData(model.getId(), model.getPoule(), model.getLevel(), model.getMatch().getId(),
|
||||
return new TreeData(model.getId(), model.getCategory(), model.getLevel(), model.getMatch().getId(),
|
||||
fromModel(model.getLeft()), fromModel(model.getRight()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user