wip: send competition data
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}*/
|
||||
}
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user