feat: add new affiliationRequest mail notif
This commit is contained in:
parent
dea91714fa
commit
520d00adc7
@ -58,6 +58,9 @@ public class AffiliationService {
|
||||
@ConfigProperty(name = "upload_dir")
|
||||
String media;
|
||||
|
||||
@ConfigProperty(name = "notif.affRequest.mail")
|
||||
List<String> mails;
|
||||
|
||||
public Uni<List<AffiliationRequestModel>> getAllReq() {
|
||||
return repositoryRequest.listAll();
|
||||
}
|
||||
@ -140,7 +143,7 @@ public class AffiliationService {
|
||||
}
|
||||
|
||||
public Uni<String> save(AffiliationRequestForm form) {
|
||||
// noinspection ResultOfMethodCallIgnored
|
||||
// noinspection ResultOfMethodCallIgnored,ReactiveStreamsUnusedPublisher
|
||||
return pre_save(form, true)
|
||||
.chain(model -> Panache.withTransaction(() -> repositoryRequest.persist(model)))
|
||||
.onItem()
|
||||
@ -149,6 +152,16 @@ public class AffiliationService {
|
||||
.onItem()
|
||||
.invoke(model -> Uni.createFrom().future(Utils.replacePhoto(model.getId(), form.getStatus(), media,
|
||||
"aff_request/status")))
|
||||
.call(model -> reactiveMailer.send(
|
||||
Mail.withText("no-reply@ffsaf.fr",
|
||||
"[NOTIF] FFSAF - Nouvelle demande d'affiliation",
|
||||
String.format(
|
||||
"""
|
||||
Une nouvelle demande d'affiliation a été déposée sur l'intranet pour le club: %s.
|
||||
""", model.getName())
|
||||
).setFrom("FFSAF <no-reply@ffsaf.fr>")
|
||||
.addBcc(mails.toArray(String[]::new))
|
||||
))
|
||||
.map(__ -> "Ok");
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,8 @@ database.port=3306
|
||||
database.user=root
|
||||
database.pass=
|
||||
|
||||
notif.affRequest.mail=
|
||||
|
||||
siren-api.key=siren-ap
|
||||
quarkus.rest-client."fr.titionfire.ffsaf.rest.client.SirenService".url=https://data.siren-api.fr/
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user