feat: register for club and free mode

wip: helloasso
This commit is contained in:
2025-08-20 16:48:11 +02:00
parent dedae02676
commit 11dca5630c
14 changed files with 653 additions and 181 deletions

View File

@@ -275,6 +275,23 @@ public class ClubEndpoints {
return pdfService.getAffiliationPdf(securityCtx.getSubject());
}
@GET
@Path("/members")
@RolesAllowed({"club_president", "club_secretaire", "club_respo_intra", "club_tresorier"})
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Revoie tout les membres de votre club")
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "List des membres"),
@APIResponse(responseCode = "403", description = "Accès refusé"),
@APIResponse(responseCode = "404", description = "L'utilisateur n'est pas membre d'un club"),
@APIResponse(responseCode = "500", description = "Erreur interne du serveur")
})
public Uni<List<VerySimpleMembre>> getMembers() {
return clubService.getMembers(securityCtx);
}
@GET
@Path("/renew/{id}")
@RolesAllowed({"club_president", "club_secretaire", "club_respo_intra"})

View File

@@ -36,29 +36,31 @@ public class CompetitionEndpoints {
}
@GET
@Path("{id}/register")
@Path("{id}/register/{source}")
@Authenticated
@Produces(MediaType.APPLICATION_JSON)
public Uni<List<SimpleRegisterComb>> getRegister(@PathParam("id") Long id) {
return service.getRegister(securityCtx, id);
public Uni<List<SimpleRegisterComb>> getRegister(@PathParam("id") Long id, @PathParam("source") String source) {
return service.getRegister(securityCtx, id, source);
}
@POST
@Path("{id}/register")
@Path("{id}/register/{source}")
@Authenticated
@Produces(MediaType.APPLICATION_JSON)
@Operation(hidden = true)
public Uni<SimpleRegisterComb> addRegisterComb(@PathParam("id") Long id, RegisterRequestData data) {
return service.addRegisterComb(securityCtx, id, data);
public Uni<SimpleRegisterComb> addRegisterComb(@PathParam("id") Long id, @PathParam("source") String source,
RegisterRequestData data) {
return service.addRegisterComb(securityCtx, id, data, source);
}
@DELETE
@Path("{id}/register/{comb_id}")
@Path("{id}/register/{comb_id}/{source}")
@Authenticated
@Produces(MediaType.APPLICATION_JSON)
@Operation(hidden = true)
public Uni<Void> removeRegisterComb(@PathParam("id") Long id, @PathParam("comb_id") Long combId) {
return service.removeRegisterComb(securityCtx, id, combId);
public Uni<Void> removeRegisterComb(@PathParam("id") Long id, @PathParam("comb_id") Long combId,
@PathParam("source") String source) {
return service.removeRegisterComb(securityCtx, id, combId, source);
}
@GET

View File

@@ -12,4 +12,5 @@ public class RegisterRequestData {
private Integer weight;
private int overCategory;
private boolean lockEdit = false;
}

View File

@@ -24,6 +24,7 @@ public class SimpleRegisterComb {
private Integer weight;
private int overCategory;
private boolean hasLicenceActive;
private boolean lockEdit;
public static SimpleRegisterComb fromModel(RegisterModel register, List<LicenceModel> licences) {
MembreModel membreModel = register.getMembre();
@@ -31,6 +32,7 @@ public class SimpleRegisterComb {
(register.getCategorie() == null) ? "Catégorie inconnue" : register.getCategorie().getName(),
SimpleClubModel.fromModel(register.getClub()), membreModel.getLicence(), register.getWeight(),
register.getOverCategory(),
licences.stream().anyMatch(l -> l.isValidate() && l.getSaison() == Utils.getSaison()));
licences.stream().anyMatch(l -> l.isValidate() && l.getSaison() == Utils.getSaison()),
register.isLockEdit());
}
}

View File

@@ -0,0 +1,18 @@
package fr.titionfire.ffsaf.rest.data;
import io.quarkus.runtime.annotations.RegisterForReflection;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
@Data
@AllArgsConstructor
@RegisterForReflection
public class VerySimpleMembre {
@Schema(description = "Le nom du membre.", example = "Dupont")
private String lname = "";
@Schema(description = "Le prénom du membre.", example = "Jean")
private String fname = "";
@Schema(description = "Le numéro de licence du membre.", example = "12345")
private Integer licence;
}