commit
2cdb495402
@ -245,7 +245,7 @@ public class AffiliationService {
|
||||
keycloakService.setClubGroupMembre(m, club).map(__ -> m.getUserId()))
|
||||
.call(userId -> keycloakService.setAutoRoleMembre(userId, m.getRole(), m.getGrade_arbitrage())))
|
||||
.call(m -> Mutiny.fetch(m.getLicences())
|
||||
.call(l1 -> l1.stream().anyMatch(l -> l.getSaison() == saison) ?
|
||||
.call(l1 -> l1 != null && l1.stream().anyMatch(l -> l.getSaison() == saison) ?
|
||||
Uni.createFrom().nullItem() :
|
||||
Panache.withTransaction(() -> licenceRepository.persist(
|
||||
new LicenceModel(null, m, saison, null, true)))));
|
||||
|
||||
@ -185,7 +185,7 @@ public class AffiliationRequestEndpoints {
|
||||
})
|
||||
public Uni<Response> getStatus(
|
||||
@Parameter(description = "L'identifiant de la demande d'affiliation") @PathParam("id") long id) throws URISyntaxException {
|
||||
return Utils.getMediaFile(id, media, "aff_request/status", "affiliation_request_" + id + ".pdf",
|
||||
return Utils.getMediaFile(id, media, "aff_request/status", "affiliation_request_" + id,
|
||||
Uni.createFrom().nullItem());
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ public class ClubEndpoints {
|
||||
return clubService.getById(id).onItem().invoke(checkPerm).chain(Unchecked.function(clubModel -> {
|
||||
try {
|
||||
return Utils.getMediaFile(clubModel.getId(), media, "clubStatus",
|
||||
"statue-" + clubModel.getName() + ".pdf", Uni.createFrom().nullItem());
|
||||
"statue-" + clubModel.getName(), Uni.createFrom().nullItem());
|
||||
} catch (URISyntaxException e) {
|
||||
throw new InternalError();
|
||||
}
|
||||
|
||||
@ -162,12 +162,20 @@ public class Utils {
|
||||
return Uni.createFrom().item(() -> {
|
||||
String mimeType = URLConnection.guessContentTypeFromName(filePair.getKey().getName());
|
||||
|
||||
|
||||
String filename = out_filename;
|
||||
if (filename != null && (filename.length() < 5 || filename.lastIndexOf(
|
||||
'.') <= filename.length() - 6)) {
|
||||
filename += filePair.getKey().getName()
|
||||
.substring(filePair.getKey().getName().lastIndexOf('.'));
|
||||
}
|
||||
|
||||
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; " + ((out_filename == null) ? "" : "filename=\"" + out_filename + "\""));
|
||||
"inline; " + ((filename == null) ? "" : "filename=\"" + filename + "\""));
|
||||
return resp.build();
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user