Tournament management

This commit is contained in:
2026-05-06 13:28:10 +02:00
parent 67d27ab21c
commit c70b9c554e
20 changed files with 1667 additions and 36 deletions
+1 -1
View File
@@ -14,6 +14,6 @@ public class Event
public DateTime Start { get; set; }
public DateTime End { get; set; }
public required List<Tournament> Tournaments { get; set; }
public List<Tournament> Tournaments { get; set; } = [];
}
+1 -1
View File
@@ -47,6 +47,6 @@ public class Game
public RuleSet? S2RuleSet { get; set; }
public required List<Tournament> Tournaments { get; set; }
public List<Tournament> Tournaments { get; set; } = [];
}
+3 -3
View File
@@ -11,8 +11,8 @@ public class Match
public int Id { get; set; }
public int TournamentId { get; set; }
public required List<TeamParticipant> Teams;
public required List<Round> Rounds;
public required Tournament Tournament { get; set; }
public List<TeamParticipant> Teams { get; set; } = [];
public List<Round> Rounds { get; set; } = [];
public Tournament Tournament { get; set; } = null!;
}
+14 -6
View File
@@ -7,9 +7,8 @@ public class PlayerParticipant
{
public int RoundId { get; set; }
public int PlayerId { get; set; }
public required Player Player { get; set; }
public required Round Round { get; set; }
public Player Player { get; set; } = null!;
public Round Round { get; set; } = null!;
}
[PrimaryKey(nameof(MatchId), nameof(TeamId))]
@@ -19,7 +18,16 @@ public class TeamParticipant
public int TeamId { get; set; }
public int Seed { get; set; }
public int Score { get; set; }
public Team Team { get; set; } = null!;
public Match Round { get; set; } = null!;
}
public required Team Team { get; set; }
public required Match Round { get; set; }
}
[PrimaryKey(nameof(TournamentId), nameof(TeamId))]
public class TournamentTeam
{
public int TournamentId { get; set; }
public int TeamId { get; set; }
public int Seed { get; set; }
public Tournament Tournament { get; set; } = null!;
public Team Team { get; set; } = null!;
}
+1 -1
View File
@@ -14,6 +14,6 @@ public class Player
public string Contact { get; set; } = "discordname";
public int TeamId { get; set; }
public required Team Team { get; set; }
public Team Team { get; set; } = null!;
}
+2 -2
View File
@@ -19,7 +19,7 @@ public class Round
public int MatchId { get; set; }
public RoundState State { get; set; } = RoundState.Waiting;
public required List<PlayerParticipant> Players;
public required Match Match { get; set; }
public List<PlayerParticipant> Players { get; set; } = [];
public Match Match { get; set; } = null!;
}
+3 -2
View File
@@ -14,7 +14,8 @@ public class Team
public int? LeaderId { get; set; }
public Player? Leader { get; set; }
public required List<Player> Players { get; set; }
public required List<TeamParticipant> Matches { get; set; }
public List<Player> Players { get; set; } = [];
public List<TeamParticipant> Matches { get; set; } = [];
public List<TournamentTeam> TournamentTeams { get; set; } = [];
}
+4 -2
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -21,8 +22,9 @@ public class Tournament
public int? S1GroupAdvances { get; set; }
public RuleSet? S2RuleSet { get; set; }
public required Game Game { get; set; }
public required Event Event { get; set; }
public Game Game { get; set; } = null!;
public Event Event { get; set; } = null!;
public List<TournamentTeam> TournamentTeams { get; set; } = [];
public static ValidationResult ValidateDates(DateTime date, ValidationContext context)
{