wip: club
This commit is contained in:
@@ -1,29 +1,79 @@
|
||||
package fr.titionfire.ffsaf.rest;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.ClubModel;
|
||||
import fr.titionfire.ffsaf.domain.service.AffiliationService;
|
||||
import fr.titionfire.ffsaf.rest.data.SimpleAffiliation;
|
||||
import fr.titionfire.ffsaf.rest.from.AffiliationForm;
|
||||
import fr.titionfire.ffsaf.rest.from.AffiliationRequestForm;
|
||||
import fr.titionfire.ffsaf.utils.GroupeUtils;
|
||||
import io.quarkus.oidc.IdToken;
|
||||
import io.quarkus.security.identity.SecurityIdentity;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import io.smallrye.mutiny.unchecked.Unchecked;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import org.eclipse.microprofile.jwt.JsonWebToken;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Path("api/affiliation")
|
||||
public class AffiliationEndpoints {
|
||||
|
||||
@Inject
|
||||
AffiliationService service;
|
||||
|
||||
@Inject
|
||||
@IdToken
|
||||
JsonWebToken idToken;
|
||||
|
||||
@Inject
|
||||
SecurityIdentity securityIdentity;
|
||||
|
||||
Consumer<ClubModel> checkPerm = Unchecked.consumer(clubModel -> {
|
||||
if (!securityIdentity.getRoles().contains("federation_admin") && !GroupeUtils.isInClubGroup(clubModel.getId(), idToken))
|
||||
throw new ForbiddenException();
|
||||
});
|
||||
|
||||
@POST
|
||||
@Path("save")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
public Uni<String> saveAffRequest(AffiliationRequestForm form) {
|
||||
System.out.println(form);
|
||||
return Uni.createFrom().item("OK");
|
||||
}
|
||||
/*@POST
|
||||
@Path("affiliation")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
public Uni<String> saveAffRequest(AffiliationRequestForm form) {
|
||||
System.out.println(form);
|
||||
return service.save(form);
|
||||
}*/
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/current")
|
||||
@RolesAllowed({"federation_admin"})
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<SimpleAffiliation>> getCurrentSaisonLicenceAdmin() {
|
||||
return service.getCurrentSaisonAffiliation();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed({"federation_admin", "club_president", "club_secretaire", "club_respo_intra"})
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<List<SimpleAffiliation>> getLicence(@PathParam("id") long id) {
|
||||
return service.getAffiliation(id, checkPerm);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("{id}")
|
||||
@RolesAllowed("federation_admin")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
public Uni<SimpleAffiliation> setLicence(@PathParam("id") long id, AffiliationForm form) {
|
||||
return service.setAffiliation(id, form);
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("federation_admin")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public Uni<?> deleteLicence(@PathParam("id") long id) {
|
||||
return service.deleteAffiliation(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,18 @@
|
||||
package fr.titionfire.ffsaf.rest;
|
||||
|
||||
import fr.titionfire.ffsaf.domain.service.AffiliationService;
|
||||
import fr.titionfire.ffsaf.rest.client.SirenService;
|
||||
import fr.titionfire.ffsaf.rest.data.UniteLegaleRoot;
|
||||
import fr.titionfire.ffsaf.rest.from.AffiliationRequestForm;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jodd.net.MimeTypes;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
@Path("api/asso")
|
||||
public class AssoEndpoints {
|
||||
|
||||
@RestClient
|
||||
SirenService sirenService;
|
||||
|
||||
@Inject
|
||||
AffiliationService service;
|
||||
|
||||
@ConfigProperty(name = "upload_dir")
|
||||
String media;
|
||||
|
||||
@GET
|
||||
@Path("siren/{siren}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@@ -42,12 +25,4 @@ public class AssoEndpoints {
|
||||
return throwable;
|
||||
});
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("affiliation")
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
public Uni<String> saveAffRequest(AffiliationRequestForm form) {
|
||||
return service.save(form);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
package fr.titionfire.ffsaf.rest;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.ClubModel;
|
||||
import fr.titionfire.ffsaf.domain.service.ClubService;
|
||||
import fr.titionfire.ffsaf.net2.data.SimpleClubModel;
|
||||
import fr.titionfire.ffsaf.rest.data.SimpleClub;
|
||||
import fr.titionfire.ffsaf.rest.from.FullClubForm;
|
||||
import fr.titionfire.ffsaf.utils.GroupeUtils;
|
||||
import fr.titionfire.ffsaf.utils.PageResult;
|
||||
import fr.titionfire.ffsaf.utils.Utils;
|
||||
import io.quarkus.oidc.IdToken;
|
||||
import io.quarkus.security.Authenticated;
|
||||
import io.quarkus.security.identity.SecurityIdentity;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import io.smallrye.mutiny.unchecked.Unchecked;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.eclipse.microprofile.jwt.JsonWebToken;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Path("api/club")
|
||||
public class ClubEndpoints {
|
||||
@@ -18,6 +31,22 @@ public class ClubEndpoints {
|
||||
@Inject
|
||||
ClubService clubService;
|
||||
|
||||
@Inject
|
||||
@IdToken
|
||||
JsonWebToken idToken;
|
||||
|
||||
@Inject
|
||||
SecurityIdentity securityIdentity;
|
||||
|
||||
@ConfigProperty(name = "upload_dir")
|
||||
String media;
|
||||
|
||||
Consumer<ClubModel> checkPerm = Unchecked.consumer(membreModel -> {
|
||||
if (!securityIdentity.getRoles().contains("federation_admin") && !GroupeUtils.isInClubGroup(membreModel.getId(),
|
||||
idToken))
|
||||
throw new ForbiddenException();
|
||||
});
|
||||
|
||||
@GET
|
||||
@Path("/no_detail")
|
||||
@Authenticated
|
||||
@@ -25,4 +54,110 @@ public class ClubEndpoints {
|
||||
public Uni<List<SimpleClubModel>> getAll() {
|
||||
return clubService.getAll().map(clubModels -> clubModels.stream().map(SimpleClubModel::fromModel).toList());
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/find")
|
||||
@RolesAllowed({"federation_admin"})
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<PageResult<SimpleClubModel>> getFindAdmin(@QueryParam("limit") Integer limit,
|
||||
@QueryParam("page") Integer page,
|
||||
@QueryParam("search") String search,
|
||||
@QueryParam("country") String country) {
|
||||
if (limit == null)
|
||||
limit = 50;
|
||||
if (page == null || page < 1)
|
||||
page = 1;
|
||||
return clubService.search(limit, page - 1, search, country);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed({"federation_admin", "club_president", "club_secretaire", "club_respo_intra"})
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<SimpleClub> getById(@PathParam("id") long id) {
|
||||
return clubService.getById(id).onItem().invoke(checkPerm).map(SimpleClub::fromModel);
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("{id}")
|
||||
@RolesAllowed({"federation_admin"})
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
public Uni<String> setAdminClub(@PathParam("id") long id, FullClubForm input) {
|
||||
return clubService.update(id, input)
|
||||
.invoke(Unchecked.consumer(out -> {
|
||||
if (!out.equals("OK")) throw new InternalError("Fail to update data: " + out);
|
||||
})).chain(() -> {
|
||||
if (input.getLogo().length > 0)
|
||||
return Uni.createFrom().future(Utils.replacePhoto(id, input.getLogo(), media, "ppClub"
|
||||
)).invoke(Unchecked.consumer(out -> {
|
||||
if (!out.equals("OK")) throw new InternalError("Fail to get MimeType " + out);
|
||||
}));
|
||||
else
|
||||
return Uni.createFrom().nullItem();
|
||||
}).chain(() -> {
|
||||
if (input.getStatus().length > 0)
|
||||
return Uni.createFrom().future(Utils.replacePhoto(id, input.getStatus(), media, "clubStatus"
|
||||
)).invoke(Unchecked.consumer(out -> {
|
||||
if (!out.equals("OK")) throw new InternalError("Fail to get MimeType " + out);
|
||||
}));
|
||||
else
|
||||
return Uni.createFrom().nullItem();
|
||||
});
|
||||
}
|
||||
|
||||
@POST
|
||||
@RolesAllowed({"federation_admin"})
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
public Uni<Long> addAdminClub(FullClubForm input) {
|
||||
return clubService.add(input)
|
||||
.invoke(Unchecked.consumer(id -> {
|
||||
if (id == null) throw new InternalError("Fail to create club data");
|
||||
})).call(id -> {
|
||||
if (input.getLogo().length > 0)
|
||||
return Uni.createFrom().future(Utils.replacePhoto(id, input.getLogo(), media, "ppClub"
|
||||
));
|
||||
else
|
||||
return Uni.createFrom().nullItem();
|
||||
}).call(id -> {
|
||||
if (input.getStatus().length > 0)
|
||||
return Uni.createFrom().future(Utils.replacePhoto(id, input.getStatus(), media, "clubStatus"
|
||||
));
|
||||
else
|
||||
return Uni.createFrom().nullItem();
|
||||
});
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed({"federation_admin"})
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
public Uni<?> deleteAdminClub(@PathParam("id") long id) {
|
||||
return clubService.delete(id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{clubId}/logo")
|
||||
@RolesAllowed({"federation_admin", "club_president", "club_secretaire", "club_respo_intra"})
|
||||
public Uni<Response> getLogo(@PathParam("clubId") String clubId) {
|
||||
return clubService.getByClubId(clubId).onItem().invoke(checkPerm).chain(Unchecked.function(clubModel -> {
|
||||
try {
|
||||
return Utils.getMediaFile((clubModel != null) ? clubModel.getId() : -1, media, "ppClub",
|
||||
Uni.createFrom().nullItem());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new InternalError();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("{id}/status")
|
||||
@RolesAllowed({"federation_admin", "club_president", "club_secretaire"})
|
||||
public Uni<Response> getStatus(@PathParam("id") long id) throws URISyntaxException {
|
||||
return Utils.getMediaFile(id, media, "clubStatus", clubService.getById(id).onItem().invoke(checkPerm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import fr.titionfire.ffsaf.rest.from.ClubMemberForm;
|
||||
import fr.titionfire.ffsaf.rest.from.FullMemberForm;
|
||||
import fr.titionfire.ffsaf.utils.GroupeUtils;
|
||||
import fr.titionfire.ffsaf.utils.PageResult;
|
||||
import fr.titionfire.ffsaf.utils.Pair;
|
||||
import fr.titionfire.ffsaf.utils.Utils;
|
||||
import io.quarkus.oidc.IdToken;
|
||||
import io.quarkus.security.Authenticated;
|
||||
@@ -17,7 +16,6 @@ import io.smallrye.mutiny.unchecked.Unchecked;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.*;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import jodd.net.MimeTypes;
|
||||
@@ -25,7 +23,6 @@ import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.eclipse.microprofile.jwt.JsonWebToken;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
@@ -51,7 +48,8 @@ public class CombEndpoints {
|
||||
SecurityIdentity securityIdentity;
|
||||
|
||||
Consumer<MembreModel> checkPerm = Unchecked.consumer(membreModel -> {
|
||||
if (!securityIdentity.getRoles().contains("federation_admin") && !GroupeUtils.isInClubGroup(membreModel.getClub().getId(), idToken))
|
||||
if (!securityIdentity.getRoles().contains("federation_admin") && !GroupeUtils.isInClubGroup(
|
||||
membreModel.getClub().getId(), idToken))
|
||||
throw new ForbiddenException();
|
||||
});
|
||||
|
||||
@@ -213,37 +211,7 @@ public class CombEndpoints {
|
||||
@Path("{id}/photo")
|
||||
@RolesAllowed({"federation_admin", "club_president", "club_secretaire", "club_respo_intra"})
|
||||
public Uni<Response> getPhoto(@PathParam("id") long id) throws URISyntaxException {
|
||||
Future<Pair<File, byte[]>> future = CompletableFuture.supplyAsync(() -> {
|
||||
FilenameFilter filter = (directory, filename) -> filename.startsWith(String.valueOf(id));
|
||||
File[] files = new File(media, "ppMembre").listFiles(filter);
|
||||
if (files != null && files.length > 0) {
|
||||
File file = files[0];
|
||||
try {
|
||||
byte[] data = Files.readAllBytes(file.toPath());
|
||||
return new Pair<>(file, data);
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
URI uri = new URI("https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava2.webp");
|
||||
|
||||
return membreService.getById(id).onItem().invoke(checkPerm).chain(__ -> Uni.createFrom().future(future)
|
||||
.map(filePair -> {
|
||||
if (filePair == null)
|
||||
return Response.temporaryRedirect(uri).build();
|
||||
|
||||
String mimeType = URLConnection.guessContentTypeFromName(filePair.getKey().getName());
|
||||
|
||||
Response.ResponseBuilder resp = Response.ok(filePair.getValue());
|
||||
resp.type(MediaType.APPLICATION_OCTET_STREAM);
|
||||
resp.header(HttpHeaders.CONTENT_LENGTH, filePair.getValue().length);
|
||||
resp.header(HttpHeaders.CONTENT_TYPE, mimeType);
|
||||
resp.header(HttpHeaders.CONTENT_DISPOSITION, "inline; ");
|
||||
|
||||
return resp.build();
|
||||
}));
|
||||
return Utils.getMediaFile(id, media, "ppMembre", membreService.getById(id).onItem().invoke(checkPerm));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.AffiliationModel;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class SimpleAffiliation {
|
||||
Long id;
|
||||
Long club;
|
||||
int saison;
|
||||
boolean validate;
|
||||
|
||||
public static SimpleAffiliation fromModel(AffiliationModel model, boolean validate) {
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
return new SimpleAffiliationBuilder()
|
||||
.id(model.getId())
|
||||
.club(model.getClub().getId())
|
||||
.saison(model.getSaison())
|
||||
.validate(validate)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
53
src/main/java/fr/titionfire/ffsaf/rest/data/SimpleClub.java
Normal file
53
src/main/java/fr/titionfire/ffsaf/rest/data/SimpleClub.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.ClubModel;
|
||||
import fr.titionfire.ffsaf.utils.Contact;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class SimpleClub {
|
||||
private Long id;
|
||||
private String clubId;
|
||||
private String name;
|
||||
private String country;
|
||||
private String shieldURL;
|
||||
private Map<Contact, String> contact;
|
||||
private String training_location;
|
||||
private String training_day_time;
|
||||
private String contact_intern;
|
||||
private String RNA;
|
||||
private String SIRET;
|
||||
private String no_affiliation;
|
||||
private boolean international;
|
||||
|
||||
public static SimpleClub fromModel(ClubModel model) {
|
||||
if (model == null)
|
||||
return null;
|
||||
|
||||
return new SimpleClubBuilder()
|
||||
.id(model.getId())
|
||||
.clubId(model.getClubId())
|
||||
.name(model.getName())
|
||||
.country(model.getCountry())
|
||||
.shieldURL(model.getShieldURL())
|
||||
.contact(model.getContact())
|
||||
.training_location(model.getTraining_location())
|
||||
.training_day_time(model.getTraining_day_time())
|
||||
.contact_intern(model.getContact_intern())
|
||||
.RNA(model.getRNA())
|
||||
.SIRET(model.getSIRET())
|
||||
.no_affiliation(model.getNo_affiliation())
|
||||
.international(model.isInternational())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package fr.titionfire.ffsaf.rest.from;
|
||||
|
||||
public class AffiliationForm {
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package fr.titionfire.ffsaf.rest.from;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.AffiliationRequestModel;
|
||||
import fr.titionfire.ffsaf.utils.RoleAsso;
|
||||
import jakarta.ws.rs.FormParam;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import lombok.Getter;
|
||||
@@ -14,7 +15,7 @@ public class AffiliationRequestForm {
|
||||
private String name = null;
|
||||
|
||||
@FormParam("siren")
|
||||
private String siren = null;
|
||||
private Long siren = null;
|
||||
|
||||
@FormParam("rna")
|
||||
private String rna = null;
|
||||
@@ -30,32 +31,38 @@ public class AffiliationRequestForm {
|
||||
@PartType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
private byte[] logo = new byte[0];
|
||||
|
||||
@FormParam("president-nom")
|
||||
private String president_lname = null;
|
||||
@FormParam("president-prenom")
|
||||
private String president_fname = null;
|
||||
@FormParam("president-mail")
|
||||
private String president_email = null;
|
||||
@FormParam("president-licence")
|
||||
private String president_lincence = null;
|
||||
@FormParam("m1_nom")
|
||||
private String m1_lname = null;
|
||||
@FormParam("m1_prenom")
|
||||
private String m1_fname = null;
|
||||
@FormParam("m1_mail")
|
||||
private String m1_email = null;
|
||||
@FormParam("m1_licence")
|
||||
private String m1_lincence = null;
|
||||
@FormParam("m1_role")
|
||||
private RoleAsso m1_role = null;
|
||||
|
||||
@FormParam("tresorier-nom")
|
||||
private String tresorier_lname = null;
|
||||
@FormParam("tresorier-prenom")
|
||||
private String tresorier_fname = null;
|
||||
@FormParam("tresorier-mail")
|
||||
private String tresorier_email = null;
|
||||
@FormParam("tresorier-licence")
|
||||
private String tresorier_lincence = null;
|
||||
@FormParam("m2_nom")
|
||||
private String m2_lname = null;
|
||||
@FormParam("m2_prenom")
|
||||
private String m2_fname = null;
|
||||
@FormParam("m2_mail")
|
||||
private String m2_email = null;
|
||||
@FormParam("m2_licence")
|
||||
private String m2_lincence = null;
|
||||
@FormParam("m2_role")
|
||||
private RoleAsso m2_role = null;
|
||||
|
||||
@FormParam("secretaire-nom")
|
||||
private String secretaire_lname = null;
|
||||
@FormParam("secretaire-prenom")
|
||||
private String secretaire_fname = null;
|
||||
@FormParam("secretaire-mail")
|
||||
private String secretaire_email = null;
|
||||
@FormParam("secretaire-licence")
|
||||
private String secretaire_lincence = null;
|
||||
@FormParam("m3_nom")
|
||||
private String m3_lname = null;
|
||||
@FormParam("m3_prenom")
|
||||
private String m3_fname = null;
|
||||
@FormParam("m3_mail")
|
||||
private String m3_email = null;
|
||||
@FormParam("m3_licence")
|
||||
private String m3_lincence = null;
|
||||
@FormParam("m3_role")
|
||||
private RoleAsso m3_role = null;
|
||||
|
||||
public AffiliationRequestModel toModel() {
|
||||
AffiliationRequestModel model = new AffiliationRequestModel();
|
||||
@@ -64,23 +71,26 @@ public class AffiliationRequestForm {
|
||||
model.setRNA(this.getRna());
|
||||
model.setAddress(this.getAdresse());
|
||||
|
||||
model.setPresident_lname(this.getPresident_lname());
|
||||
model.setPresident_fname(this.getPresident_fname());
|
||||
model.setPresident_email(this.getPresident_email());
|
||||
model.setPresident_lincence((this.getPresident_lincence() == null || this.getPresident_lincence().isBlank())
|
||||
? 0 : Integer.parseInt(this.getPresident_lincence()));
|
||||
model.setM1_lname(this.getM1_lname());
|
||||
model.setM1_fname(this.getM1_fname());
|
||||
model.setM1_email(this.getM1_email());
|
||||
model.setM1_lincence((this.getM1_lincence() == null || this.getM1_lincence().isBlank())
|
||||
? 0 : Integer.parseInt(this.getM1_lincence()));
|
||||
model.setM1_role(this.getM1_role());
|
||||
|
||||
model.setTresorier_lname(this.getTresorier_lname());
|
||||
model.setTresorier_fname(this.getTresorier_fname());
|
||||
model.setTresorier_email(this.getTresorier_email());
|
||||
model.setTresorier_lincence((this.getPresident_lincence() == null || this.getPresident_lincence().isBlank())
|
||||
? 0 : Integer.parseInt(this.getTresorier_lincence()));
|
||||
model.setM2_lname(this.getM2_lname());
|
||||
model.setM2_fname(this.getM2_fname());
|
||||
model.setM2_email(this.getM2_email());
|
||||
model.setM2_lincence((this.getM1_lincence() == null || this.getM1_lincence().isBlank())
|
||||
? 0 : Integer.parseInt(this.getM2_lincence()));
|
||||
model.setM2_role(this.getM2_role());
|
||||
|
||||
model.setSecretaire_lname(this.getSecretaire_lname());
|
||||
model.setSecretaire_fname(this.getSecretaire_fname());
|
||||
model.setSecretaire_email(this.getSecretaire_email());
|
||||
model.setSecretaire_lincence((this.getPresident_lincence() == null || this.getPresident_lincence().isBlank())
|
||||
? 0 : Integer.parseInt(this.getSecretaire_lincence()));
|
||||
model.setM3_lname(this.getM3_lname());
|
||||
model.setM3_fname(this.getM3_fname());
|
||||
model.setM3_email(this.getM3_email());
|
||||
model.setM3_lincence((this.getM1_lincence() == null || this.getM1_lincence().isBlank())
|
||||
? 0 : Integer.parseInt(this.getM3_lincence()));
|
||||
model.setM3_role(this.getM3_role());
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package fr.titionfire.ffsaf.rest.from;
|
||||
|
||||
import jakarta.ws.rs.FormParam;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import lombok.Getter;
|
||||
import org.jboss.resteasy.reactive.PartType;
|
||||
|
||||
@Getter
|
||||
public class FullClubForm {
|
||||
@FormParam("id")
|
||||
private String id = null;
|
||||
|
||||
@FormParam("name")
|
||||
private String name = null;
|
||||
|
||||
@FormParam("status")
|
||||
@PartType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
private byte[] status = new byte[0];
|
||||
|
||||
@FormParam("logo")
|
||||
@PartType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
private byte[] logo = new byte[0];
|
||||
}
|
||||
Reference in New Issue
Block a user