feat: add get private socket endpoint
This commit is contained in:
@@ -4,6 +4,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import fr.titionfire.ffsaf.net2.Client_Thread;
|
||||
import fr.titionfire.ffsaf.net2.Message;
|
||||
import io.quarkus.hibernate.reactive.panache.common.WithSession;
|
||||
import io.quarkus.vertx.SafeVertxContext;
|
||||
import jakarta.transaction.Transactional;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import fr.titionfire.ffsaf.net2.Client_Thread;
|
||||
import fr.titionfire.ffsaf.net2.Message;
|
||||
import jakarta.transaction.Transactional;
|
||||
|
||||
public interface IAction {
|
||||
void dataIn(Client_Thread client_Thread, Message<JsonNode> message) throws JsonProcessingException;
|
||||
|
||||
39
src/main/java/fr/titionfire/ffsaf/net2/packet/RClub.java
Normal file
39
src/main/java/fr/titionfire/ffsaf/net2/packet/RClub.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package fr.titionfire.ffsaf.net2.packet;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.ClubModel;
|
||||
import fr.titionfire.ffsaf.net2.ServerCustom;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class RClub {
|
||||
private static final Logger LOGGER = Logger.getLogger(RClub.class);
|
||||
|
||||
final CIA<Long> findByIdOptionalClub = new CIA<>(Long.class, (client_Thread, message) -> {
|
||||
try {
|
||||
ClubModel clubModel = ServerCustom.getInstance().clubService.findByIdOptionalClub(message.data());
|
||||
client_Thread.sendRepTo(clubModel, message);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
client_Thread.sendErrTo(e.getMessage(), message);
|
||||
}
|
||||
});
|
||||
|
||||
final IAction findAllClub = (client_Thread, message) -> {
|
||||
try {
|
||||
Collection<ClubModel> clubModels = ServerCustom.getInstance().clubService.findAllClub();
|
||||
client_Thread.sendRepTo(clubModels, message);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
client_Thread.sendErrTo(e.getMessage(), message);
|
||||
}
|
||||
};
|
||||
|
||||
public static void register(HashMap<String, IAction> iMap) {
|
||||
RClub rClub = new RClub();
|
||||
|
||||
iMap.put("findByIdOptionalClub", rClub.findByIdOptionalClub);
|
||||
iMap.put("findAllClub", rClub.findAllClub);
|
||||
}
|
||||
}
|
||||
40
src/main/java/fr/titionfire/ffsaf/net2/packet/RComb.java
Normal file
40
src/main/java/fr/titionfire/ffsaf/net2/packet/RComb.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package fr.titionfire.ffsaf.net2.packet;
|
||||
|
||||
import fr.titionfire.ffsaf.data.model.CombModel;
|
||||
import fr.titionfire.ffsaf.net2.ServerCustom;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@ApplicationScoped
|
||||
public class RComb {
|
||||
private static final Logger LOGGER = Logger.getLogger(RComb.class);
|
||||
|
||||
final IAction findComb = (client_Thread, message) -> {
|
||||
try {
|
||||
CombModel combModel = ServerCustom.getInstance().combService.find(message.data().get("licence").asInt(), message.data().get("np").asText());
|
||||
client_Thread.sendRepTo(combModel, message);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
client_Thread.sendErrTo(e.getMessage(), message);
|
||||
}
|
||||
};
|
||||
|
||||
final CIA<Long> findByIdOptionalComb = new CIA<>(Long.class, (client_Thread, message) -> {
|
||||
try {
|
||||
CombModel combModel = ServerCustom.getInstance().combService.findByIdOptionalComb(message.data());
|
||||
client_Thread.sendRepTo(combModel, message);
|
||||
} catch (Throwable e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
client_Thread.sendErrTo(e.getMessage(), message);
|
||||
}
|
||||
});
|
||||
|
||||
public static void register(HashMap<String, IAction> iMap) {
|
||||
RComb rComb = new RComb();
|
||||
|
||||
iMap.put("findComb", rComb.findComb);
|
||||
iMap.put("findByIdOptionalComb", rComb.findByIdOptionalComb);
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,7 @@ public class RegisterAction {
|
||||
public static void register(HashMap<String, IAction> iMap) {
|
||||
iMap.clear();
|
||||
|
||||
RComb.register(iMap);
|
||||
RClub.register(iMap);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user