feat: notify Membre update to ws client
This commit is contained in:
parent
f604e64966
commit
d84ec9e1b4
@ -3,7 +3,9 @@ package fr.titionfire.ffsaf.domain.service;
|
|||||||
import fr.titionfire.ffsaf.data.model.MembreModel;
|
import fr.titionfire.ffsaf.data.model.MembreModel;
|
||||||
import fr.titionfire.ffsaf.data.repository.ClubRepository;
|
import fr.titionfire.ffsaf.data.repository.ClubRepository;
|
||||||
import fr.titionfire.ffsaf.data.repository.CombRepository;
|
import fr.titionfire.ffsaf.data.repository.CombRepository;
|
||||||
|
import fr.titionfire.ffsaf.net2.ServerCustom;
|
||||||
import fr.titionfire.ffsaf.net2.data.SimpleCombModel;
|
import fr.titionfire.ffsaf.net2.data.SimpleCombModel;
|
||||||
|
import fr.titionfire.ffsaf.net2.request.SReqComb;
|
||||||
import fr.titionfire.ffsaf.rest.from.FullMemberForm;
|
import fr.titionfire.ffsaf.rest.from.FullMemberForm;
|
||||||
import fr.titionfire.ffsaf.utils.Pair;
|
import fr.titionfire.ffsaf.utils.Pair;
|
||||||
import io.quarkus.hibernate.reactive.panache.Panache;
|
import io.quarkus.hibernate.reactive.panache.Panache;
|
||||||
@ -25,6 +27,8 @@ public class MembreService {
|
|||||||
CombRepository repository;
|
CombRepository repository;
|
||||||
@Inject
|
@Inject
|
||||||
ClubRepository clubRepository;
|
ClubRepository clubRepository;
|
||||||
|
@Inject
|
||||||
|
ServerCustom serverCustom;
|
||||||
|
|
||||||
public SimpleCombModel find(int licence, String np) throws Throwable {
|
public SimpleCombModel find(int licence, String np) throws Throwable {
|
||||||
return VertxContextSupport.subscribeAndAwait(() -> Panache.withTransaction(() ->
|
return VertxContextSupport.subscribeAndAwait(() -> Panache.withTransaction(() ->
|
||||||
@ -59,6 +63,8 @@ public class MembreService {
|
|||||||
m.setGrade_arbitrage(membre.getGrade_arbitrage());
|
m.setGrade_arbitrage(membre.getGrade_arbitrage());
|
||||||
m.setEmail(membre.getEmail());
|
m.setEmail(membre.getEmail());
|
||||||
return Panache.withTransaction(() -> repository.persist(m));
|
return Panache.withTransaction(() -> repository.persist(m));
|
||||||
}).map(__ -> "OK");
|
})
|
||||||
|
.invoke(membreModel -> SReqComb.sendIfNeed(serverCustom.clients, SimpleCombModel.fromModel(membreModel)))
|
||||||
|
.map(__ -> "OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
src/main/java/fr/titionfire/ffsaf/net2/request/SReqClub.java
Normal file
24
src/main/java/fr/titionfire/ffsaf/net2/request/SReqClub.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package fr.titionfire.ffsaf.net2.request;
|
||||||
|
|
||||||
|
import fr.titionfire.ffsaf.net2.Client_Thread;
|
||||||
|
import fr.titionfire.ffsaf.net2.data.SimpleClubModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class SReqClub {
|
||||||
|
public static void sendIfNeed(ArrayList<Client_Thread> client_Thread, SimpleClubModel club) {
|
||||||
|
for (Client_Thread client : client_Thread) {
|
||||||
|
client.sendNotify(club, "sendClub");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void sendAddIfNeed(ArrayList<Client_Thread> client_Thread, SimpleClubModel club) {
|
||||||
|
for (Client_Thread client : client_Thread) {
|
||||||
|
client.sendNotify(club, "sendAddClub");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void sendRmIfNeed(ArrayList<Client_Thread> client_Thread, long club) {
|
||||||
|
for (Client_Thread client : client_Thread) {
|
||||||
|
client.sendNotify(club, "sendRmClub");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
src/main/java/fr/titionfire/ffsaf/net2/request/SReqComb.java
Normal file
27
src/main/java/fr/titionfire/ffsaf/net2/request/SReqComb.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package fr.titionfire.ffsaf.net2.request;
|
||||||
|
|
||||||
|
import fr.titionfire.ffsaf.net2.Client_Thread;
|
||||||
|
import fr.titionfire.ffsaf.net2.data.SimpleCombModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class SReqComb {
|
||||||
|
|
||||||
|
public static void sendIfNeed(ArrayList<Client_Thread> client_Thread, SimpleCombModel comb) {
|
||||||
|
for (Client_Thread client : client_Thread) {
|
||||||
|
client.sendNotify(comb, "sendComb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendIfNeedAdd(ArrayList<Client_Thread> client_Thread, SimpleCombModel comb) {
|
||||||
|
for (Client_Thread client : client_Thread) {
|
||||||
|
client.sendNotify(comb, "sendAddComb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendRm(ArrayList<Client_Thread> client_Thread, long id) {
|
||||||
|
for (Client_Thread client : client_Thread) {
|
||||||
|
client.sendNotify(id, "sendRmComb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user