feat: add team card when comb is register

This commit is contained in:
2026-02-05 22:07:14 +01:00
parent 89d9e04a6f
commit b37902466c
3 changed files with 52 additions and 7 deletions

View File

@@ -97,9 +97,10 @@ public class RCard {
@WSReceiver(code = "sendCardRm", permission = PermLevel.ADMIN)
public Uni<Void> sendCardRm(WebSocketConnection connection, SendCardAdd card) {
return getById(card.matchId(), connection)
.chain(matchModel -> cardRepository.find("match = ?1 AND comb = ?2 AND type = ?3",
matchModel.getId(), card.combId(), card.type())
return competitionRepository.find("uuid", connection.pathParam("uuid")).firstResult()
.chain(competition -> cardRepository.find(
"match IS NULL AND comb = ?1 AND type = ?2 AND competition = ?3 AND match " + (card.matchId() == null ? "IS NULL" : "= " + card.matchId()),
card.combId(), card.type(), competition)
.firstResult()
.invoke(Unchecked.consumer(o -> {
if (o == null)
@@ -143,7 +144,7 @@ public class RCard {
}
@RegisterForReflection
public record SendCardAdd(long matchId, long combId, CardModel.CardType type, String reason) {
public record SendCardAdd(Long matchId, long combId, CardModel.CardType type, String reason) {
}
@RegisterForReflection