fix(me): access to photo
This commit is contained in:
parent
972d599642
commit
3869ad50e9
@ -131,6 +131,10 @@ public class MembreService {
|
|||||||
.call(m -> Mutiny.fetch(m.getLicences()));
|
.call(m -> Mutiny.fetch(m.getLicences()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Uni<MembreModel> getByAccountId(String subject) {
|
||||||
|
return repository.find("userId = ?1", subject).firstResult();
|
||||||
|
}
|
||||||
|
|
||||||
public Uni<MembreModel> getByLicence(long licence) {
|
public Uni<MembreModel> getByLicence(long licence) {
|
||||||
return repository.find("licence = ?1", licence).firstResult();
|
return repository.find("licence = ?1", licence).firstResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ public class MembreEndpoints {
|
|||||||
@Authenticated
|
@Authenticated
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Operation(summary = "Renvoie l'attestation d'adhesion du membre connecté", description = "Renvoie l'attestation d'adhesion du " +
|
@Operation(summary = "Renvoie l'attestation d'adhesion du membre connecté", description = "Renvoie l'attestation d'adhesion du " +
|
||||||
"membre connecté, y compris le club et les licences")
|
"membre connecté")
|
||||||
@APIResponses(value = {
|
@APIResponses(value = {
|
||||||
@APIResponse(responseCode = "200", description = "L'attestation d'adhesion"),
|
@APIResponse(responseCode = "200", description = "L'attestation d'adhesion"),
|
||||||
@APIResponse(responseCode = "403", description = "Accès refusé"),
|
@APIResponse(responseCode = "403", description = "Accès refusé"),
|
||||||
@ -109,6 +109,21 @@ public class MembreEndpoints {
|
|||||||
return membreService.getLicencePdf(securityCtx.getSubject());
|
return membreService.getLicencePdf(securityCtx.getSubject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("me/photo")
|
||||||
|
@Authenticated
|
||||||
|
@Operation(summary = "Renvoie la photo du membre connecté", description = "Renvoie la photo du membre connecté")
|
||||||
|
@APIResponses(value = {
|
||||||
|
@APIResponse(responseCode = "200", description = "La photo"),
|
||||||
|
@APIResponse(responseCode = "403", description = "Accès refusé"),
|
||||||
|
@APIResponse(responseCode = "500", description = "Erreur interne du serveur")
|
||||||
|
})
|
||||||
|
public Uni<Response> getMePhoto() {
|
||||||
|
return membreService.getByAccountId(securityCtx.getSubject())
|
||||||
|
.chain(Unchecked.function(
|
||||||
|
m -> Utils.getMediaFile(m.getId(), media, "ppMembre", Uni.createFrom().nullItem())));
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}/photo")
|
@Path("{id}/photo")
|
||||||
@RolesAllowed({"federation_admin", "club_president", "club_secretaire", "club_respo_intra"})
|
@RolesAllowed({"federation_admin", "club_president", "club_secretaire", "club_respo_intra"})
|
||||||
|
|||||||
@ -73,7 +73,7 @@ function PhotoCard({data}) {
|
|||||||
<div className="card-body text-center">
|
<div className="card-body text-center">
|
||||||
<div className="input-group mb-3">
|
<div className="input-group mb-3">
|
||||||
<img
|
<img
|
||||||
src={`${vite_url}/api/member/${data.id}/photo`}
|
src={`${vite_url}/api/member/me/photo`}
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
className="rounded-circle img-fluid" style={{object_fit: 'contain'}}/>
|
className="rounded-circle img-fluid" style={{object_fit: 'contain'}}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user