diff --git a/docs/prompts.md b/docs/prompts.md index 35e0739..8f8a6c7 100644 --- a/docs/prompts.md +++ b/docs/prompts.md @@ -4,6 +4,16 @@ - offene Sachstrafen von einem Tag zum nächsten fortschreiben - +## Planung Phase 2 +Phase 1 MVP ist nun abgeschlossen. Jetzt planen wir die Phase 2 "Detaillierte Spielverwaltung". + + Innerhalb eines nicht abgeschlossenen Spieltages sollen beliebig viele Spiele gestartet und zugeordnet werden. Die Spiele-Ansicht soll aus einem Eingabe-Panel und + einer "Tafel" also einer pro Spiel unterschiedlichen Ansicht für den Spielstatus bestehen. Alles soll ich im Speicher auf der Tag-Details seite befinden. Beim + Hin- und Herspringen zwischen den Tag-Details, der Kegel-Eingabe und der Tafel soll die Brwoser-Seite nicht jedes mal neu geladen werden. + Beim Start eines Spiels sollen individuelle Steup-Komponenten angezeigt werden, je nach gewähltem Spiel-Typ. + Dieses Grundprinzip kannst du aus dem nicht mehr aktiven Projekt KoggleApp extrahieren. + Denke hart über diesen Input nach und überlege, wie das im Projekt Koogle.Web integriert werden kann. Starte noch nicht mit der Umsetzung sondern präsentiere mir + deinen Plan und stelle Rückfragen. ## Optimierung Spieltag-Details Blende die Erledigt-Kennzeichnung (Als bezahlt markieren) in der Tabelle mit den Staten () für Geldstrafen aus. Nur Sachstrafen sollen sich manuell erledigen lassen. Geldstrafen werden später zentral über die Abrechnung des gesamten Tages erledigt. diff --git a/src/Koogle.Domain/Entities/Game.cs b/src/Koogle.Domain/Entities/Game.cs index 586bd7c..5c136c7 100644 --- a/src/Koogle.Domain/Entities/Game.cs +++ b/src/Koogle.Domain/Entities/Game.cs @@ -30,5 +30,19 @@ namespace Koogle.Domain.Entities /// reference to the participating Persons. /// public ICollection GamePersons { get; set; } = new List(); + + + // Zuordnungen + + /// + /// ID of the referenced Club. + /// + public Guid ClubId { get; set; } + + + /// + /// reference to the associated Club. + /// + public Club Club { get; set; } = null!; } } diff --git a/src/Koogle.Infrastructure/Data/Migrations/20251226091512_GameClubRelation.Designer.cs b/src/Koogle.Infrastructure/Data/Migrations/20251226091512_GameClubRelation.Designer.cs new file mode 100644 index 0000000..c8817de --- /dev/null +++ b/src/Koogle.Infrastructure/Data/Migrations/20251226091512_GameClubRelation.Designer.cs @@ -0,0 +1,922 @@ +// +using System; +using KoogleApp.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Koogle.Infrastructure.Data.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20251226091512_GameClubRelation")] + partial class GameClubRelation + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("app") + .HasAnnotation("ProductVersion", "9.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Koogle.Domain.Entities.Club", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpenseCalculation") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("Clubs", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.ClubInvitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpiresAt") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("MaxUses") + .HasColumnType("int"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Token") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("UsedCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClubId"); + + b.HasIndex("Token") + .IsUnique(); + + b.ToTable("ClubInvitations", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Day", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId1") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("PostDate") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClubId1"); + + b.HasIndex("ClubId", "PostDate"); + + b.ToTable("Days", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.DayPerson", b => + { + b.Property("DayId") + .HasColumnType("uniqueidentifier"); + + b.Property("PersonId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("DayId", "PersonId"); + + b.HasIndex("ClubId"); + + b.HasIndex("DayId"); + + b.HasIndex("PersonId"); + + b.HasIndex("DayId", "ClubId"); + + b.HasIndex("PersonId", "ClubId"); + + b.ToTable("DayPersons", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Expense", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId1") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("ExpenseType") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsInverse") + .HasColumnType("bit"); + + b.Property("IsOneClick") + .HasColumnType("bit"); + + b.Property("IsVariable") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Price") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("ClubId"); + + b.HasIndex("ClubId1"); + + b.HasIndex("ClubId", "Name"); + + b.ToTable("Expenses", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.ExpenseTrigger", b => + { + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpenseId") + .HasColumnType("uniqueidentifier"); + + b.Property("TriggerId") + .HasColumnType("uniqueidentifier"); + + b.Property("AssignedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("SYSUTCDATETIME()"); + + b.Property("AssignedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("ClubId", "ExpenseId", "TriggerId"); + + b.HasIndex("ClubId"); + + b.HasIndex("ExpenseId"); + + b.HasIndex("TriggerId"); + + b.HasIndex("ExpenseId", "ClubId"); + + b.ToTable("ExpenseTriggers", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Game", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("DayId") + .HasColumnType("uniqueidentifier"); + + b.Property("GameData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ClubId"); + + b.HasIndex("DayId"); + + b.ToTable("Games", "app", t => + { + t.HasCheckConstraint("CK_Games_GameData_IsJson", "ISJSON([GameData]) > 0"); + }); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.GamePerson", b => + { + b.Property("GameId") + .HasColumnType("uniqueidentifier"); + + b.Property("PersonId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("GameId", "PersonId"); + + b.HasIndex("ClubId"); + + b.HasIndex("GameId"); + + b.HasIndex("PersonId"); + + b.ToTable("GamePersons", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Person", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId1") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("PersonStatus") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClubId"); + + b.HasIndex("ClubId1"); + + b.ToTable("Persons", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.PersonExpense", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssignedById") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("DayId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpenseId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpenseType") + .HasColumnType("int"); + + b.Property("GameId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("PersonExpenseStatus") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("uniqueidentifier"); + + b.Property("Price") + .HasPrecision(18, 2) + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("ClubId"); + + b.HasIndex("DayId"); + + b.HasIndex("ExpenseId"); + + b.HasIndex("GameId"); + + b.HasIndex("PersonId", "DayId"); + + b.ToTable("PersonExpenses", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Trigger", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpenseTriggerType") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("ExpenseTriggerType"); + + b.ToTable("Triggers", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.UserProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("IdentityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Locale") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("varchar(20)"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("TimeZone") + .HasMaxLength(64) + .IsUnicode(false) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("IdentityUserId") + .IsUnique(); + + b.ToTable("UserProfiles", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.UserProfileClub", b => + { + b.Property("UserProfileId") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("ApprovedAt") + .HasColumnType("datetime2"); + + b.Property("ApprovedById") + .HasColumnType("uniqueidentifier"); + + b.Property("AssignedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("SYSUTCDATETIME()"); + + b.Property("AssignedById") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId1") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("RejectedAt") + .HasColumnType("datetime2"); + + b.Property("RejectedById") + .HasColumnType("uniqueidentifier"); + + b.Property("RejectionReason") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("UserProfileId", "ClubId"); + + b.HasIndex("ClubId"); + + b.HasIndex("ClubId1"); + + b.HasIndex("UserProfileId") + .IsUnique() + .HasFilter("[IsDefault] = 1"); + + b.ToTable("UserProfileClubs", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.UserProfileClubRoleAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssignedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("SYSUTCDATETIME()"); + + b.Property("AssignedById") + .HasColumnType("uniqueidentifier"); + + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("UserProfileId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ClubId"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserProfileId", "ClubId", "RoleId") + .IsUnique() + .HasFilter("[IsDeleted] = 0"); + + b.ToTable("UserProfileClubRoleAssignments", "app"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.ClubInvitation", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Club"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Day", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Club", null) + .WithMany("Days") + .HasForeignKey("ClubId1"); + + b.Navigation("Club"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.DayPerson", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Day", "Day") + .WithMany("DayPersons") + .HasForeignKey("DayId", "ClubId") + .HasPrincipalKey("Id", "ClubId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Person", "Person") + .WithMany("DayPersons") + .HasForeignKey("PersonId", "ClubId") + .HasPrincipalKey("Id", "ClubId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Club"); + + b.Navigation("Day"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Expense", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Club", null) + .WithMany("Expenses") + .HasForeignKey("ClubId1"); + + b.Navigation("Club"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.ExpenseTrigger", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Trigger", "Trigger") + .WithMany() + .HasForeignKey("TriggerId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Expense", "Expense") + .WithMany() + .HasForeignKey("ExpenseId", "ClubId") + .HasPrincipalKey("Id", "ClubId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Club"); + + b.Navigation("Expense"); + + b.Navigation("Trigger"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Game", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Day", "Day") + .WithMany() + .HasForeignKey("DayId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Club"); + + b.Navigation("Day"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.GamePerson", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Game", "Game") + .WithMany("GamePersons") + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Person", "Person") + .WithMany() + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Club"); + + b.Navigation("Game"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Person", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Club", null) + .WithMany("Persons") + .HasForeignKey("ClubId1"); + + b.Navigation("Club"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.PersonExpense", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Day", "Day") + .WithMany() + .HasForeignKey("DayId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Expense", "Expense") + .WithMany() + .HasForeignKey("ExpenseId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Game", "Game") + .WithMany() + .HasForeignKey("GameId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Koogle.Domain.Entities.Person", "Person") + .WithMany("Expenses") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Club"); + + b.Navigation("Day"); + + b.Navigation("Expense"); + + b.Navigation("Game"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.UserProfileClub", b => + { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Koogle.Domain.Entities.Club", null) + .WithMany("Users") + .HasForeignKey("ClubId1"); + + b.HasOne("Koogle.Domain.Entities.UserProfile", "UserProfile") + .WithMany("Clubs") + .HasForeignKey("UserProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Club"); + + b.Navigation("UserProfile"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.UserProfileClubRoleAssignment", b => + { + b.HasOne("Koogle.Domain.Entities.UserProfileClub", "UserProfileClub") + .WithMany("RoleAssignments") + .HasForeignKey("UserProfileId", "ClubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("UserProfileClub"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Club", b => + { + b.Navigation("Days"); + + b.Navigation("Expenses"); + + b.Navigation("Persons"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Day", b => + { + b.Navigation("DayPersons"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Game", b => + { + b.Navigation("GamePersons"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.Person", b => + { + b.Navigation("DayPersons"); + + b.Navigation("Expenses"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.UserProfile", b => + { + b.Navigation("Clubs"); + }); + + modelBuilder.Entity("Koogle.Domain.Entities.UserProfileClub", b => + { + b.Navigation("RoleAssignments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Koogle.Infrastructure/Data/Migrations/20251226091512_GameClubRelation.cs b/src/Koogle.Infrastructure/Data/Migrations/20251226091512_GameClubRelation.cs new file mode 100644 index 0000000..30e14ea --- /dev/null +++ b/src/Koogle.Infrastructure/Data/Migrations/20251226091512_GameClubRelation.cs @@ -0,0 +1,58 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Koogle.Infrastructure.Data.Migrations +{ + /// + public partial class GameClubRelation : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ClubId", + schema: "app", + table: "Games", + type: "uniqueidentifier", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateIndex( + name: "IX_Games_ClubId", + schema: "app", + table: "Games", + column: "ClubId"); + + migrationBuilder.AddForeignKey( + name: "FK_Games_Clubs_ClubId", + schema: "app", + table: "Games", + column: "ClubId", + principalSchema: "app", + principalTable: "Clubs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Games_Clubs_ClubId", + schema: "app", + table: "Games"); + + migrationBuilder.DropIndex( + name: "IX_Games_ClubId", + schema: "app", + table: "Games"); + + migrationBuilder.DropColumn( + name: "ClubId", + schema: "app", + table: "Games"); + } + } +} diff --git a/src/Koogle.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs b/src/Koogle.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs index b7bfc75..83f5aff 100644 --- a/src/Koogle.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs +++ b/src/Koogle.Infrastructure/Data/Migrations/AppDbContextModelSnapshot.cs @@ -277,6 +277,9 @@ namespace Koogle.Infrastructure.Data.Migrations .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); + b.Property("ClubId") + .HasColumnType("uniqueidentifier"); + b.Property("CreatedAt") .HasColumnType("datetime2"); @@ -301,6 +304,8 @@ namespace Koogle.Infrastructure.Data.Migrations b.HasKey("Id"); + b.HasIndex("ClubId"); + b.HasIndex("DayId"); b.ToTable("Games", "app", t => @@ -736,12 +741,20 @@ namespace Koogle.Infrastructure.Data.Migrations modelBuilder.Entity("Koogle.Domain.Entities.Game", b => { + b.HasOne("Koogle.Domain.Entities.Club", "Club") + .WithMany() + .HasForeignKey("ClubId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Koogle.Domain.Entities.Day", "Day") .WithMany() .HasForeignKey("DayId") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); + b.Navigation("Club"); + b.Navigation("Day"); });