Add Team functions

This commit is contained in:
2025-09-22 12:53:46 -04:00
parent 3daa3b81b3
commit dc83a18d76
48 changed files with 2364 additions and 633 deletions
+3
View File
@@ -73,6 +73,9 @@ namespace Data
.WithMany(e => e.Teams);
builder.HasOne(e => e.Captain);
builder.Property(e => e.Number).IsRequired(false);
//builder.i
}
}
public class StudentEventRankingConfiguration : IEntityTypeConfiguration<StudentEventRanking>
@@ -54,7 +54,7 @@ namespace Data.Migrations
});
migrationBuilder.CreateTable(
name: "Teams",
name: "TimeSlots",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
@@ -91,7 +91,7 @@ namespace Data.Migrations
table.ForeignKey(
name: "FK_StudentTeam_Teams_TeamsId",
column: x => x.TeamsId,
principalTable: "Teams",
principalTable: "TimeSlots",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@@ -108,7 +108,7 @@ namespace Data.Migrations
migrationBuilder.CreateIndex(
name: "IX_Teams_CaptainId",
table: "Teams",
table: "TimeSlots",
column: "CaptainId");
}
@@ -122,7 +122,7 @@ namespace Data.Migrations
name: "StudentTeam");
migrationBuilder.DropTable(
name: "Teams");
name: "TimeSlots");
migrationBuilder.DropTable(
name: "Students");
@@ -12,7 +12,7 @@ namespace Data.Migrations
{
migrationBuilder.RenameColumn(
name: "TeamNumber",
table: "Teams",
table: "TimeSlots",
newName: "TeamId");
migrationBuilder.RenameColumn(
@@ -36,7 +36,7 @@ namespace Data.Migrations
{
migrationBuilder.RenameColumn(
name: "TeamId",
table: "Teams",
table: "TimeSlots",
newName: "TeamNumber");
migrationBuilder.RenameColumn(
@@ -12,14 +12,14 @@ namespace Data.Migrations
{
migrationBuilder.AddColumn<int>(
name: "EventId",
table: "Teams",
table: "TimeSlots",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Teams",
table: "TimeSlots",
type: "TEXT",
nullable: false,
defaultValue: "");
@@ -47,12 +47,12 @@ namespace Data.Migrations
migrationBuilder.CreateIndex(
name: "IX_Teams_EventId",
table: "Teams",
table: "TimeSlots",
column: "EventId");
migrationBuilder.AddForeignKey(
name: "FK_Teams_Events_EventId",
table: "Teams",
table: "TimeSlots",
column: "EventId",
principalTable: "Events",
principalColumn: "Id",
@@ -64,19 +64,19 @@ namespace Data.Migrations
{
migrationBuilder.DropForeignKey(
name: "FK_Teams_Events_EventId",
table: "Teams");
table: "TimeSlots");
migrationBuilder.DropIndex(
name: "IX_Teams_EventId",
table: "Teams");
table: "TimeSlots");
migrationBuilder.DropColumn(
name: "EventId",
table: "Teams");
table: "TimeSlots");
migrationBuilder.DropColumn(
name: "Name",
table: "Teams");
table: "TimeSlots");
migrationBuilder.DropColumn(
name: "Email",
+255
View File
@@ -0,0 +1,255 @@
// <auto-generated />
using Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Data.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20250915175030_AddTeamNumber")]
partial class AddTeamNumber
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
modelBuilder.Entity("Core.Entities.EventDefinition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("Documentation")
.HasColumnType("TEXT");
b.Property<string>("Eligibility")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("EventFormat")
.HasColumnType("INTEGER");
b.Property<int?>("LevelOfEffort")
.HasColumnType("INTEGER");
b.Property<int>("MaxTeamCountState")
.HasColumnType("INTEGER");
b.Property<int>("MaxTeamSize")
.HasColumnType("INTEGER");
b.Property<int>("MinTeamSize")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Notes")
.HasColumnType("TEXT");
b.Property<bool>("RegionalEvent")
.HasColumnType("INTEGER");
b.Property<bool>("RegionalPresubmit")
.HasColumnType("INTEGER");
b.Property<string>("SemifinalistActivity")
.HasColumnType("TEXT");
b.Property<string>("ShortName")
.HasColumnType("TEXT");
b.Property<bool>("StatePreliminaryRound")
.HasColumnType("INTEGER");
b.Property<bool>("StatePresubmission")
.HasColumnType("INTEGER");
b.Property<bool>("StatePretesting")
.HasColumnType("INTEGER");
b.Property<string>("Theme")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name");
b.ToTable("Events");
});
modelBuilder.Entity("Core.Entities.Student", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("Grade")
.HasColumnType("INTEGER");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("NationalId")
.HasColumnType("TEXT");
b.Property<int?>("OfficerRole")
.HasColumnType("INTEGER");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<string>("RegionalId")
.HasColumnType("TEXT");
b.Property<string>("StateId")
.HasColumnType("TEXT");
b.Property<int>("TsaYear")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Students");
});
modelBuilder.Entity("Core.Entities.StudentEventRanking", b =>
{
b.Property<int>("EventDefinitionId")
.HasColumnType("INTEGER");
b.Property<int>("StudentId")
.HasColumnType("INTEGER");
b.Property<int>("Rank")
.HasColumnType("INTEGER");
b.HasKey("EventDefinitionId", "StudentId");
b.HasIndex("StudentId");
b.ToTable("StudentEventRanking");
});
modelBuilder.Entity("Core.Entities.Team", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("CaptainId")
.HasColumnType("INTEGER");
b.Property<int>("EventId")
.HasColumnType("INTEGER");
b.Property<int>("Number")
.HasColumnType("INTEGER");
b.Property<string>("TeamId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CaptainId");
b.HasIndex("EventId");
b.ToTable("Teams");
});
modelBuilder.Entity("StudentTeam", b =>
{
b.Property<int>("StudentsId")
.HasColumnType("INTEGER");
b.Property<int>("TeamsId")
.HasColumnType("INTEGER");
b.HasKey("StudentsId", "TeamsId");
b.HasIndex("TeamsId");
b.ToTable("StudentTeam");
});
modelBuilder.Entity("Core.Entities.StudentEventRanking", b =>
{
b.HasOne("Core.Entities.EventDefinition", "EventDefinition")
.WithMany()
.HasForeignKey("EventDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Core.Entities.Student", "Student")
.WithMany("EventRankings")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EventDefinition");
b.Navigation("Student");
});
modelBuilder.Entity("Core.Entities.Team", b =>
{
b.HasOne("Core.Entities.Student", "Captain")
.WithMany()
.HasForeignKey("CaptainId");
b.HasOne("Core.Entities.EventDefinition", "Event")
.WithMany()
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Captain");
b.Navigation("Event");
});
modelBuilder.Entity("StudentTeam", b =>
{
b.HasOne("Core.Entities.Student", null)
.WithMany()
.HasForeignKey("StudentsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Core.Entities.Team", null)
.WithMany()
.HasForeignKey("TeamsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Core.Entities.Student", b =>
{
b.Navigation("EventRankings");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,40 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations
{
/// <inheritdoc />
public partial class AddTeamNumber : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Name",
table: "TimeSlots");
migrationBuilder.AddColumn<int>(
name: "Number",
table: "TimeSlots",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Number",
table: "TimeSlots");
migrationBuilder.AddColumn<string>(
name: "Name",
table: "TimeSlots",
type: "TEXT",
nullable: false,
defaultValue: "");
}
}
}
@@ -0,0 +1,255 @@
// <auto-generated />
using Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Data.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20250917165027_NullableTeamNumber")]
partial class NullableTeamNumber
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.8");
modelBuilder.Entity("Core.Entities.EventDefinition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Description")
.HasColumnType("TEXT");
b.Property<string>("Documentation")
.HasColumnType("TEXT");
b.Property<string>("Eligibility")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("EventFormat")
.HasColumnType("INTEGER");
b.Property<int?>("LevelOfEffort")
.HasColumnType("INTEGER");
b.Property<int>("MaxTeamCountState")
.HasColumnType("INTEGER");
b.Property<int>("MaxTeamSize")
.HasColumnType("INTEGER");
b.Property<int>("MinTeamSize")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("TEXT");
b.Property<string>("Notes")
.HasColumnType("TEXT");
b.Property<bool>("RegionalEvent")
.HasColumnType("INTEGER");
b.Property<bool>("RegionalPresubmit")
.HasColumnType("INTEGER");
b.Property<string>("SemifinalistActivity")
.HasColumnType("TEXT");
b.Property<string>("ShortName")
.HasColumnType("TEXT");
b.Property<bool>("StatePreliminaryRound")
.HasColumnType("INTEGER");
b.Property<bool>("StatePresubmission")
.HasColumnType("INTEGER");
b.Property<bool>("StatePretesting")
.HasColumnType("INTEGER");
b.Property<string>("Theme")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name");
b.ToTable("Events");
});
modelBuilder.Entity("Core.Entities.Student", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.HasColumnType("TEXT");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("Grade")
.HasColumnType("INTEGER");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("NationalId")
.HasColumnType("TEXT");
b.Property<int?>("OfficerRole")
.HasColumnType("INTEGER");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<string>("RegionalId")
.HasColumnType("TEXT");
b.Property<string>("StateId")
.HasColumnType("TEXT");
b.Property<int>("TsaYear")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Students");
});
modelBuilder.Entity("Core.Entities.StudentEventRanking", b =>
{
b.Property<int>("EventDefinitionId")
.HasColumnType("INTEGER");
b.Property<int>("StudentId")
.HasColumnType("INTEGER");
b.Property<int>("Rank")
.HasColumnType("INTEGER");
b.HasKey("EventDefinitionId", "StudentId");
b.HasIndex("StudentId");
b.ToTable("StudentEventRanking");
});
modelBuilder.Entity("Core.Entities.Team", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("CaptainId")
.HasColumnType("INTEGER");
b.Property<int>("EventId")
.HasColumnType("INTEGER");
b.Property<int?>("Number")
.HasColumnType("INTEGER");
b.Property<string>("TeamId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CaptainId");
b.HasIndex("EventId");
b.ToTable("Teams");
});
modelBuilder.Entity("StudentTeam", b =>
{
b.Property<int>("StudentsId")
.HasColumnType("INTEGER");
b.Property<int>("TeamsId")
.HasColumnType("INTEGER");
b.HasKey("StudentsId", "TeamsId");
b.HasIndex("TeamsId");
b.ToTable("StudentTeam");
});
modelBuilder.Entity("Core.Entities.StudentEventRanking", b =>
{
b.HasOne("Core.Entities.EventDefinition", "EventDefinition")
.WithMany()
.HasForeignKey("EventDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Core.Entities.Student", "Student")
.WithMany("EventRankings")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EventDefinition");
b.Navigation("Student");
});
modelBuilder.Entity("Core.Entities.Team", b =>
{
b.HasOne("Core.Entities.Student", "Captain")
.WithMany()
.HasForeignKey("CaptainId");
b.HasOne("Core.Entities.EventDefinition", "Event")
.WithMany()
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Captain");
b.Navigation("Event");
});
modelBuilder.Entity("StudentTeam", b =>
{
b.HasOne("Core.Entities.Student", null)
.WithMany()
.HasForeignKey("StudentsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Core.Entities.Team", null)
.WithMany()
.HasForeignKey("TeamsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Core.Entities.Student", b =>
{
b.Navigation("EventRankings");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.Migrations
{
/// <inheritdoc />
public partial class NullableTeamNumber : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "Number",
table: "TimeSlots",
type: "INTEGER",
nullable: true,
oldClrType: typeof(int),
oldType: "INTEGER");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "Number",
table: "TimeSlots",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER",
oldNullable: true);
}
}
}
+3 -4
View File
@@ -161,9 +161,8 @@ namespace Data.Migrations
b.Property<int>("EventId")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Number")
.HasColumnType("INTEGER");
b.Property<string>("TeamId")
.HasColumnType("TEXT");
@@ -174,7 +173,7 @@ namespace Data.Migrations
b.HasIndex("EventId");
b.ToTable("Teams");
b.ToTable("TimeSlots");
});
modelBuilder.Entity("StudentTeam", b =>