feat: move competition setting to ffsaf site

This commit is contained in:
2024-08-09 12:09:37 +02:00
parent b766525000
commit 27dd22080c
43 changed files with 1616 additions and 34 deletions

View File

@@ -40,7 +40,7 @@ public class Client_Thread extends Thread {
private boolean isAuth;
private final HashMap<UUID, JsonConsumer<Object>> waitResult = new HashMap<>();
private final HashMap<UUID, JsonConsumer<?>> waitResult = new HashMap<>();
public Client_Thread(ServerCustom serv, Socket s, PublicKey publicKey) throws IOException {
this.serv = serv;
@@ -162,7 +162,7 @@ public class Client_Thread extends Thread {
sendReq(object, type, null);
}
public void sendReq(Object object, String code, JsonConsumer<Object> consumer) {
public void sendReq(Object object, String code, JsonConsumer<?> consumer) {
UUID uuid;
do {
uuid = UUID.randomUUID();

View File

@@ -0,0 +1,10 @@
package fr.titionfire.ffsaf.net2.data;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.util.List;
import java.util.UUID;
@RegisterForReflection
public record SimpleCompet(long id, String owner, boolean show_blason, boolean show_flag, List<UUID> admin, List<UUID> table) {
}

View File

@@ -0,0 +1,40 @@
package fr.titionfire.ffsaf.net2.request;
import fr.titionfire.ffsaf.net2.Client_Thread;
import fr.titionfire.ffsaf.net2.data.SimpleCompet;
import fr.titionfire.ffsaf.utils.JsonConsumer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.CompletableFuture;
public class SReqCompet {
public static void sendUpdate(ArrayList<Client_Thread> client_Thread, SimpleCompet compet) {
for (Client_Thread client : client_Thread) {
client.sendNotify(compet, "sendConfig");
}
}
public static void getConfig(ArrayList<Client_Thread> client_Thread, long id_compet,
CompletableFuture<SimpleCompet> future) {
if (client_Thread.isEmpty()) return;
client_Thread.get(0).sendReq(id_compet, "getConfig",
new JsonConsumer<>(SimpleCompet.class, future::complete));
}
public static void getAllHaveAccess(ArrayList<Client_Thread> client_Thread, String userId,
CompletableFuture<HashMap<Long, String>> future) {
if (client_Thread.isEmpty()) return;
client_Thread.get(0).sendReq(userId, "getAllHaveAccess",
new JsonConsumer<>(HashMap.class, future::complete));
}
public static void rmCompet(ArrayList<Client_Thread> client_Thread, long id_compet) {
for (Client_Thread client : client_Thread) {
client.sendNotify(id_compet, "rmCompet");
}
}
}