All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m25s
54 lines
1.6 KiB
Java
54 lines
1.6 KiB
Java
package fr.titionfire.ffsaf.rest.data;
|
|
|
|
import fr.titionfire.ffsaf.data.model.CompetitionModel;
|
|
import fr.titionfire.ffsaf.utils.Categorie;
|
|
import fr.titionfire.ffsaf.utils.CompetitionSystem;
|
|
import fr.titionfire.ffsaf.data.model.RegisterModel;
|
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Data;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
@Data
|
|
@AllArgsConstructor
|
|
@RegisterForReflection
|
|
public class CompetitionData {
|
|
private Long id;
|
|
private String name;
|
|
private String uuid;
|
|
private Date date;
|
|
private CompetitionSystem system;
|
|
private Long club;
|
|
private String clubName;
|
|
private String owner;
|
|
private List<SimpleRegister> registers;
|
|
|
|
public static CompetitionData fromModel(CompetitionModel model) {
|
|
if (model == null)
|
|
return null;
|
|
|
|
return new CompetitionData(model.getId(), model.getName(), model.getUuid(), model.getDate(), model.getSystem(),
|
|
model.getClub().getId(), model.getClub().getName(), model.getOwner(), null);
|
|
}
|
|
|
|
public CompetitionData addInsc(List<RegisterModel> insc) {
|
|
this.registers = insc.stream()
|
|
.map(i -> new SimpleRegister(i.getMembre().getId(), i.getOverCategory(), i.getWeight(),
|
|
i.getCategorie(), (i.getClub() == null) ? null : i.getClub().getId())).toList();
|
|
return this;
|
|
}
|
|
|
|
@Data
|
|
@AllArgsConstructor
|
|
@RegisterForReflection
|
|
public static class SimpleRegister {
|
|
long id;
|
|
int overCategory;
|
|
Integer weight;
|
|
Categorie categorie;
|
|
Long club;
|
|
}
|
|
}
|