feat: update CardModel
This commit is contained in:
@@ -62,18 +62,18 @@ public class CardService {
|
||||
public Uni<List<CardModel>> getForMatch(MatchModel match) {
|
||||
return cardRepository.list(
|
||||
"competition = ?1 AND (type IN ?2 OR (type = CardType.BLUE AND category = ?4)) AND comb IN ?3",
|
||||
match.getCategory().getCompet().getId(), COMPETITION_LEVEL_CARDS,
|
||||
match.getCategory().getCompet(), COMPETITION_LEVEL_CARDS,
|
||||
extractCombIds(match), match.getCategory().getId());
|
||||
}
|
||||
|
||||
public Uni<List<CardModel>> getAll(Long competitionId) {
|
||||
return cardRepository.list("competition = ?1", competitionId);
|
||||
public Uni<List<CardModel>> getAll(CompetitionModel competition) {
|
||||
return cardRepository.list("competition = ?1", competition);
|
||||
}
|
||||
|
||||
public Uni<RCard.SendCardAdd> checkCanBeAdded(RCard.SendCardAdd card, MatchModel matchModel) {
|
||||
return cardRepository.find("competition = ?1 AND comb = ?2",
|
||||
Sort.descending("type"),
|
||||
matchModel.getCategory().getCompet().getId(), card.combId())
|
||||
matchModel.getCategory().getCompet(), card.combId())
|
||||
.firstResult()
|
||||
.map(card_ -> {
|
||||
if (card.type() == CardModel.CardType.BLUE) {
|
||||
@@ -119,7 +119,7 @@ public class CardService {
|
||||
.map(l -> l.stream().map(r -> r.getId() * -1).toList());
|
||||
}
|
||||
})
|
||||
.chain(combIds -> cardRepository.list("competition = ?1 AND comb IN ?2", competition.getId(), combIds)
|
||||
.chain(combIds -> cardRepository.list("competition = ?1 AND comb IN ?2", competition, combIds)
|
||||
.map(cards -> {
|
||||
List<CardModel> newCards = new ArrayList<>();
|
||||
for (Long id : combIds) {
|
||||
@@ -127,7 +127,8 @@ public class CardService {
|
||||
.filter(c -> id.equals(c.getComb()) && c.getType() == type).findAny();
|
||||
|
||||
CardModel model = new CardModel();
|
||||
model.setCompetition(competition.getId());
|
||||
model.setCompetition(competition);
|
||||
model.setCompetitionId(competition.getId());
|
||||
model.setComb(id);
|
||||
model.setTeamCard(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user