wip: send competition data

This commit is contained in:
2024-08-14 21:33:11 +02:00
parent 4be7b28efd
commit 7f80c876d3
12 changed files with 291 additions and 43 deletions

View File

@@ -19,13 +19,18 @@ public class MatchData {
private String c2_str;
private Long poule;
private long poule_ord;
private boolean isEnd = true;
private char groupe;
private List<ScoreEmbeddable> scores;
public static MatchData fromModel(MatchModel model) {
if (model == null)
return null;
return new MatchData(model.getSystemId(), model.getC1_id().getId(), model.getC1_str(), model.getC2_id().getId(),
model.getC2_str(), model.getPoule(), model.getPoule_ord(), model.getScores());
return new MatchData(model.getSystemId(),
(model.getC1_id() == null) ? null : model.getC1_id().getId(), model.getC1_str(),
(model.getC2_id() == null) ? null : model.getC2_id().getId(), model.getC2_str(),
model.getPoule().getId(), model.getPoule_ord(), model.isEnd(), model.getGroupe(),
model.getScores());
}
}

View File

@@ -0,0 +1,28 @@
package fr.titionfire.ffsaf.rest.data;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
@Data
@AllArgsConstructor
public class PouleFullData {
private Long id;
private String name;
private Long compet;
private Integer type;
private List<MatchData> matches;
private List<TreeData> trees;
/*public static PouleFullData fromModel(PouleModel pouleModel) {
if (pouleModel == null)
return null;
PouleEntity pouleEntity = PouleEntity.fromModel(pouleModel);
return new PouleFullData(pouleEntity.getId(), pouleEntity.getName(), pouleEntity.getCompet().getId(),
pouleEntity.getType(), pouleModel.getMatchs().stream().map(MatchData::fromModel).toList(),
pouleEntity.getTrees().stream().map(TreeData::fromEntity).toList());
}*/
}

View File

@@ -12,17 +12,15 @@ public class TreeData {
private Long id;
private Long poule;
private Integer level;
private MatchData match;
private Long match;
private TreeData left;
private TreeData right;
private TreeData associatedNode;
public static TreeData fromModel(TreeModel model) {
if (model == null)
return null;
return new TreeData(model.getId(), model.getPoule(), model.getLevel(), MatchData.fromModel(model.getMatch()),
fromModel(model.getLeft()),
fromModel(model.getRight()), null);
return new TreeData(model.getId(), model.getPoule(), model.getLevel(), model.getMatch().getId(),
fromModel(model.getLeft()), fromModel(model.getRight()));
}
}