feat: add privacy setting in me page
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m53s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m53s
This commit is contained in:
@@ -6,6 +6,7 @@ import fr.titionfire.ffsaf.domain.service.PDFService;
|
||||
import fr.titionfire.ffsaf.rest.data.MeData;
|
||||
import fr.titionfire.ffsaf.rest.data.SimpleMembre;
|
||||
import fr.titionfire.ffsaf.rest.exception.DForbiddenException;
|
||||
import fr.titionfire.ffsaf.rest.from.UserSettingForm;
|
||||
import fr.titionfire.ffsaf.utils.SecurityCtx;
|
||||
import fr.titionfire.ffsaf.utils.Utils;
|
||||
import io.quarkus.security.Authenticated;
|
||||
@@ -113,6 +114,21 @@ public class MembreEndpoints {
|
||||
return pdfService.getLicencePdf(securityCtx.getSubject());
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("me/setting")
|
||||
@Authenticated
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
@Produces(MediaType.TEXT_PLAIN)
|
||||
@Operation(summary = "Met à jour les paramètres du membre connecté", description = "Met à jour les paramètres du membre connecté")
|
||||
@APIResponses(value = {
|
||||
@APIResponse(responseCode = "200", description = "Les paramètres ont été mis à jour"),
|
||||
@APIResponse(responseCode = "403", description = "Accès refusé"),
|
||||
@APIResponse(responseCode = "500", description = "Erreur interne du serveur")
|
||||
})
|
||||
public Uni<Void> updateMeSettings(UserSettingForm settingForm) {
|
||||
return membreService.updateSettings(securityCtx.getSubject(), settingForm);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("me/photo")
|
||||
@Authenticated
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fr.titionfire.ffsaf.rest.data;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.MembreModel;
|
||||
import fr.titionfire.ffsaf.utils.ResultPrivacy;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -15,30 +16,32 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@RegisterForReflection
|
||||
public class MeData {
|
||||
@Schema(description = "L'identifiant du membre.", example = "1")
|
||||
@Schema(description = "L'identifiant du membre.", examples = "1")
|
||||
private long id;
|
||||
@Schema(description = "Le nom du membre.", example = "Dupont")
|
||||
@Schema(description = "Le nom du membre.", examples = "Dupont")
|
||||
private String lname = "";
|
||||
@Schema(description = "Le prénom du membre.", example = "Jean")
|
||||
@Schema(description = "Le prénom du membre.", examples = "Jean")
|
||||
private String fname = "";
|
||||
@Schema(description = "La catégorie du membre.", example = "SENIOR")
|
||||
@Schema(description = "La catégorie du membre.", examples = "SENIOR")
|
||||
private String categorie;
|
||||
@Schema(description = "Le nom du club du membre.", example = "Association sportive")
|
||||
@Schema(description = "Le nom du club du membre.", examples = "Association sportive")
|
||||
private String club;
|
||||
@Schema(description = "Le genre du membre.", example = "Homme")
|
||||
@Schema(description = "Le genre du membre.", examples = "Homme")
|
||||
private String genre;
|
||||
@Schema(description = "Le numéro de licence du membre.", example = "12345")
|
||||
@Schema(description = "Le numéro de licence du membre.", examples = "12345")
|
||||
private int licence;
|
||||
@Schema(description = "Le pays du membre.", example = "FR")
|
||||
@Schema(description = "Le pays du membre.", examples = "FR")
|
||||
private String country;
|
||||
@Schema(description = "La date de naissance du membre.")
|
||||
private Date birth_date;
|
||||
@Schema(description = "L'adresse e-mail du membre.", example = "jean.dupont@example.com")
|
||||
@Schema(description = "L'adresse e-mail du membre.", examples = "jean.dupont@examples.com")
|
||||
private String email;
|
||||
@Schema(description = "Le rôle du membre dans l'association.", example = "MEMBRE")
|
||||
@Schema(description = "Le rôle du membre dans l'association.", examples = "MEMBRE")
|
||||
private String role;
|
||||
@Schema(description = "Le grade d'arbitrage du membre.", example = "N/A")
|
||||
@Schema(description = "Le grade d'arbitrage du membre.", examples = "N/A")
|
||||
private String grade_arbitrage;
|
||||
@Schema(description = "La confidentialité des résultats", examples = "PUBLIC")
|
||||
private ResultPrivacy resultPrivacy;
|
||||
@Schema(description = "La liste des licences du membre.")
|
||||
private List<SimpleLicence> licences;
|
||||
|
||||
@@ -55,5 +58,6 @@ public class MeData {
|
||||
this.email = membreModel.getEmail();
|
||||
this.role = membreModel.getRole().str;
|
||||
this.grade_arbitrage = membreModel.getGrade_arbitrage().str;
|
||||
this.resultPrivacy = membreModel.getResultPrivacy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package fr.titionfire.ffsaf.rest.from;
|
||||
|
||||
import fr.titionfire.ffsaf.utils.ResultPrivacy;
|
||||
import jakarta.ws.rs.FormParam;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Schema;
|
||||
|
||||
@ToString
|
||||
@Getter
|
||||
public class UserSettingForm {
|
||||
@FormParam("resultPrivacy")
|
||||
@Schema(description = "La confidentialité des résultats", examples = "PUBLIC", defaultValue = "PUBLIC", required = true)
|
||||
private ResultPrivacy resultPrivacy;
|
||||
}
|
||||
Reference in New Issue
Block a user