diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..4b54435 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Debugger (launch)", + "type": "coreclr", + "request": "launch", + "program": "${command:dotrush.activeTargetPath}", + "preLaunchTask": "dotrush: Build" + }, + { + "name": ".NET Core Debugger (attach)", + "type": "coreclr", + "request": "attach", + "processId": "${command:dotrush.pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..670f6ff --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "dotrush.roslyn.projectOrSolutionFiles": [ + "/home/shield/git/upce/bcsh1/TournamentOrganizer/TournamentOrganizer.sln" + ] +} \ No newline at end of file diff --git a/TournamentOrganizer/Migrations/20260409100559_FixS1Customizers.Designer.cs b/TournamentOrganizer/Migrations/20260409100559_FixS1Customizers.Designer.cs new file mode 100644 index 0000000..cf1ba26 --- /dev/null +++ b/TournamentOrganizer/Migrations/20260409100559_FixS1Customizers.Designer.cs @@ -0,0 +1,333 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TournamentOrganizer; + +#nullable disable + +namespace TournamentOrganizer.Migrations +{ + [DbContext(typeof(TournamentContext))] + [Migration("20260409100559_FixS1Customizers")] + partial class FixS1Customizers + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "10.0.5"); + + modelBuilder.Entity("TournamentOrganizer.Models.Event", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("End") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Start") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Description") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("S1GroupAdvances") + .HasColumnType("INTEGER"); + + b.Property("S1Groups") + .HasColumnType("INTEGER"); + + b.Property("S1RuleSet") + .HasColumnType("INTEGER"); + + b.Property("S2RuleSet") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Games"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Match", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("TournamentId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("TournamentId"); + + b.ToTable("Matches"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Player", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Contact") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TeamId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("TeamId"); + + b.ToTable("Players"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.PlayerParticipant", b => + { + b.Property("RoundId") + .HasColumnType("INTEGER"); + + b.Property("PlayerId") + .HasColumnType("INTEGER"); + + b.HasKey("RoundId", "PlayerId"); + + b.HasIndex("PlayerId"); + + b.ToTable("PlayerParticipants"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Round", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("MatchId") + .HasColumnType("INTEGER"); + + b.Property("State") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("MatchId"); + + b.ToTable("Rounds"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Team", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Teams"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.TeamParticipant", b => + { + b.Property("MatchId") + .HasColumnType("INTEGER"); + + b.Property("TeamId") + .HasColumnType("INTEGER"); + + b.Property("Score") + .HasColumnType("INTEGER"); + + b.Property("Seed") + .HasColumnType("INTEGER"); + + b.HasKey("MatchId", "TeamId"); + + b.HasIndex("TeamId"); + + b.ToTable("TeamParticipants"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Tournament", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("End") + .HasColumnType("TEXT"); + + b.Property("EventId") + .HasColumnType("INTEGER"); + + b.Property("GameId") + .HasColumnType("INTEGER"); + + b.Property("S1GroupAdvances") + .HasColumnType("INTEGER"); + + b.Property("S1Groups") + .HasColumnType("INTEGER"); + + b.Property("S1RuleSet") + .HasColumnType("INTEGER"); + + b.Property("S2RuleSet") + .HasColumnType("INTEGER"); + + b.Property("Start") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("EventId"); + + b.HasIndex("GameId"); + + b.ToTable("Tournaments"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Match", b => + { + b.HasOne("TournamentOrganizer.Models.Tournament", "Tournament") + .WithMany() + .HasForeignKey("TournamentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tournament"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Player", b => + { + b.HasOne("TournamentOrganizer.Models.Team", "Team") + .WithMany("Players") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.PlayerParticipant", b => + { + b.HasOne("TournamentOrganizer.Models.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TournamentOrganizer.Models.Round", "Round") + .WithMany() + .HasForeignKey("RoundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Player"); + + b.Navigation("Round"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Round", b => + { + b.HasOne("TournamentOrganizer.Models.Match", "Match") + .WithMany() + .HasForeignKey("MatchId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Match"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.TeamParticipant", b => + { + b.HasOne("TournamentOrganizer.Models.Match", "Round") + .WithMany() + .HasForeignKey("MatchId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TournamentOrganizer.Models.Team", "Team") + .WithMany("Matches") + .HasForeignKey("TeamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Round"); + + b.Navigation("Team"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Tournament", b => + { + b.HasOne("TournamentOrganizer.Models.Event", "Event") + .WithMany("Tournaments") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TournamentOrganizer.Models.Game", "Game") + .WithMany("Tournaments") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Event"); + + b.Navigation("Game"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Event", b => + { + b.Navigation("Tournaments"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Game", b => + { + b.Navigation("Tournaments"); + }); + + modelBuilder.Entity("TournamentOrganizer.Models.Team", b => + { + b.Navigation("Matches"); + + b.Navigation("Players"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TournamentOrganizer/Migrations/20260409100559_FixS1Customizers.cs b/TournamentOrganizer/Migrations/20260409100559_FixS1Customizers.cs new file mode 100644 index 0000000..3f0be1d --- /dev/null +++ b/TournamentOrganizer/Migrations/20260409100559_FixS1Customizers.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace TournamentOrganizer.Migrations +{ + /// + public partial class FixS1Customizers : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "S1GroupAdvances", + table: "Tournaments", + type: "INTEGER", + nullable: true); + + migrationBuilder.AddColumn( + name: "S1Groups", + table: "Tournaments", + type: "INTEGER", + nullable: true); + + migrationBuilder.AddColumn( + name: "S1GroupAdvances", + table: "Games", + type: "INTEGER", + nullable: true); + + migrationBuilder.AddColumn( + name: "S1Groups", + table: "Games", + type: "INTEGER", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "S1GroupAdvances", + table: "Tournaments"); + + migrationBuilder.DropColumn( + name: "S1Groups", + table: "Tournaments"); + + migrationBuilder.DropColumn( + name: "S1GroupAdvances", + table: "Games"); + + migrationBuilder.DropColumn( + name: "S1Groups", + table: "Games"); + } + } +} diff --git a/TournamentOrganizer/Migrations/TournamentContextModelSnapshot.cs b/TournamentOrganizer/Migrations/TournamentContextModelSnapshot.cs index ee727db..1a0c035 100644 --- a/TournamentOrganizer/Migrations/TournamentContextModelSnapshot.cs +++ b/TournamentOrganizer/Migrations/TournamentContextModelSnapshot.cs @@ -52,6 +52,12 @@ namespace TournamentOrganizer.Migrations .IsRequired() .HasColumnType("TEXT"); + b.Property("S1GroupAdvances") + .HasColumnType("INTEGER"); + + b.Property("S1Groups") + .HasColumnType("INTEGER"); + b.Property("S1RuleSet") .HasColumnType("INTEGER"); @@ -188,6 +194,12 @@ namespace TournamentOrganizer.Migrations b.Property("GameId") .HasColumnType("INTEGER"); + b.Property("S1GroupAdvances") + .HasColumnType("INTEGER"); + + b.Property("S1Groups") + .HasColumnType("INTEGER"); + b.Property("S1RuleSet") .HasColumnType("INTEGER"); diff --git a/TournamentOrganizer/Models/Game.cs b/TournamentOrganizer/Models/Game.cs index 2e6aed4..979fa0a 100644 --- a/TournamentOrganizer/Models/Game.cs +++ b/TournamentOrganizer/Models/Game.cs @@ -22,8 +22,8 @@ public class Game public string Description { get; set; } = "Example Game Description"; public RuleSet S1RuleSet { get; set; } - public int S1Groups; - public int S1GroupAdvances; + public int? S1Groups { get; set; } + public int? S1GroupAdvances { get; set; } public RuleSet? S2RuleSet { get; set; } diff --git a/TournamentOrganizer/Models/Participant.cs b/TournamentOrganizer/Models/Participant.cs index 1251089..25eaa39 100644 --- a/TournamentOrganizer/Models/Participant.cs +++ b/TournamentOrganizer/Models/Participant.cs @@ -16,7 +16,7 @@ public class PlayerParticipant public required Round Round { get; set; } } - +[PrimaryKey(nameof(MatchId), nameof(TeamId))] public class TeamParticipant { public int MatchId { get; set; } diff --git a/TournamentOrganizer/Models/Tournament.cs b/TournamentOrganizer/Models/Tournament.cs index 69077c0..9c2baf9 100644 --- a/TournamentOrganizer/Models/Tournament.cs +++ b/TournamentOrganizer/Models/Tournament.cs @@ -17,8 +17,8 @@ public class Tournament public DateTime End { get; set; } public RuleSet S1RuleSet { get; set; } - public int S1Groups; - public int S1GroupAdvances; + public int? S1Groups { get; set; } + public int? S1GroupAdvances { get; set; } public RuleSet? S2RuleSet { get; set; } public required Game Game { get; set; }