Initial Commit

This commit is contained in:
2026-03-01 15:14:42 -04:00
commit f60174625e
377 changed files with 98166 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Infrastructure.Identity;
namespace SportsDivision.Infrastructure.Data;
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
public DbSet<Zone> Zones => Set<Zone>();
public DbSet<School> Schools => Set<School>();
public DbSet<Student> Students => Set<Student>();
public DbSet<EventLevel> EventLevels => Set<EventLevel>();
public DbSet<Event> Events => Set<Event>();
public DbSet<Tournament> Tournaments => Set<Tournament>();
public DbSet<TournamentEventLevel> TournamentEventLevels => Set<TournamentEventLevel>();
public DbSet<EventRegistration> EventRegistrations => Set<EventRegistration>();
public DbSet<RelayTeam> RelayTeams => Set<RelayTeam>();
public DbSet<RelayTeamMember> RelayTeamMembers => Set<RelayTeamMember>();
public DbSet<Round> Rounds => Set<Round>();
public DbSet<Heat> Heats => Set<Heat>();
public DbSet<HeatLane> HeatLanes => Set<HeatLane>();
public DbSet<HighJumpHeight> HighJumpHeights => Set<HighJumpHeight>();
public DbSet<HighJumpAttempt> HighJumpAttempts => Set<HighJumpAttempt>();
public DbSet<Score> Scores => Set<Score>();
public DbSet<ScoringConstant> ScoringConstants => Set<ScoringConstant>();
public DbSet<PlacementPointConfig> PlacementPointConfigs => Set<PlacementPointConfig>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(typeof(ApplicationDbContext).Assembly);
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class EventConfiguration : IEntityTypeConfiguration<Event>
{
public void Configure(EntityTypeBuilder<Event> builder)
{
builder.HasKey(e => e.EventId);
builder.Property(e => e.Name).IsRequired().HasMaxLength(100);
builder.Property(e => e.Category).HasConversion<string>().HasMaxLength(20);
builder.HasIndex(e => e.Name).IsUnique();
builder.HasMany(e => e.EventLevels).WithMany(el => el.Events).UsingEntity(j => j.ToTable("EventEventLevel"));
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class EventLevelConfiguration : IEntityTypeConfiguration<EventLevel>
{
public void Configure(EntityTypeBuilder<EventLevel> builder)
{
builder.HasKey(e => e.EventLevelId);
builder.Property(e => e.Name).IsRequired().HasMaxLength(100);
builder.Property(e => e.Sex).HasConversion<string>().HasMaxLength(10);
builder.Property(e => e.SchoolLevel).HasConversion<string>().HasMaxLength(20);
builder.HasIndex(e => new { e.Name, e.Sex }).IsUnique();
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class EventRegistrationConfiguration : IEntityTypeConfiguration<EventRegistration>
{
public void Configure(EntityTypeBuilder<EventRegistration> builder)
{
builder.HasKey(r => r.EventRegistrationId);
builder.HasOne(r => r.TournamentEventLevel).WithMany(t => t.Registrations).HasForeignKey(r => r.TournamentEventLevelId).OnDelete(DeleteBehavior.Cascade);
builder.HasOne(r => r.Student).WithMany(s => s.Registrations).HasForeignKey(r => r.StudentId).OnDelete(DeleteBehavior.Restrict);
builder.HasOne(r => r.RelayTeam).WithMany(rt => rt.Registrations).HasForeignKey(r => r.RelayTeamId).OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(r => new { r.TournamentEventLevelId, r.StudentId }).IsUnique().HasFilter("\"StudentId\" IS NOT NULL");
builder.Property(r => r.RegisteredBy).HasMaxLength(450);
}
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class HeatConfiguration : IEntityTypeConfiguration<Heat>
{
public void Configure(EntityTypeBuilder<Heat> builder)
{
builder.HasKey(h => h.HeatId);
builder.Property(h => h.Status).HasConversion<string>().HasMaxLength(20);
builder.HasOne(h => h.Round).WithMany(r => r.Heats).HasForeignKey(h => h.RoundId).OnDelete(DeleteBehavior.Cascade);
}
}

View File

@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class HeatLaneConfiguration : IEntityTypeConfiguration<HeatLane>
{
public void Configure(EntityTypeBuilder<HeatLane> builder)
{
builder.HasKey(h => h.HeatLaneId);
builder.Property(h => h.Time).HasPrecision(10, 3);
builder.Property(h => h.AdvanceReason).HasConversion<string>().HasMaxLength(20);
builder.Property(h => h.RecordedBy).HasMaxLength(450);
builder.HasOne(h => h.Heat).WithMany(he => he.HeatLanes).HasForeignKey(h => h.HeatId).OnDelete(DeleteBehavior.Cascade);
builder.HasOne(h => h.EventRegistration).WithMany(r => r.HeatLanes).HasForeignKey(h => h.EventRegistrationId).OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(h => new { h.HeatId, h.LaneNumber }).IsUnique();
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class HighJumpAttemptConfiguration : IEntityTypeConfiguration<HighJumpAttempt>
{
public void Configure(EntityTypeBuilder<HighJumpAttempt> builder)
{
builder.HasKey(a => a.HighJumpAttemptId);
builder.Property(a => a.Attempt1).HasConversion<string>().HasMaxLength(10);
builder.Property(a => a.Attempt2).HasConversion<string>().HasMaxLength(10);
builder.Property(a => a.Attempt3).HasConversion<string>().HasMaxLength(10);
builder.HasOne(a => a.HighJumpHeight).WithMany(h => h.Attempts).HasForeignKey(a => a.HighJumpHeightId).OnDelete(DeleteBehavior.Cascade);
builder.HasOne(a => a.EventRegistration).WithMany().HasForeignKey(a => a.EventRegistrationId).OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(a => new { a.HighJumpHeightId, a.EventRegistrationId }).IsUnique();
builder.Ignore(a => a.IsEliminated);
builder.Ignore(a => a.HasCleared);
builder.Ignore(a => a.FailCount);
}
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class HighJumpHeightConfiguration : IEntityTypeConfiguration<HighJumpHeight>
{
public void Configure(EntityTypeBuilder<HighJumpHeight> builder)
{
builder.HasKey(h => h.HighJumpHeightId);
builder.Property(h => h.Height).HasPrecision(5, 2);
builder.HasOne(h => h.TournamentEventLevel).WithMany(t => t.HighJumpHeights).HasForeignKey(h => h.TournamentEventLevelId).OnDelete(DeleteBehavior.Cascade);
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class PlacementPointConfigConfiguration : IEntityTypeConfiguration<PlacementPointConfig>
{
public void Configure(EntityTypeBuilder<PlacementPointConfig> builder)
{
builder.HasKey(p => p.PlacementPointConfigId);
builder.HasIndex(p => p.Placement).IsUnique();
}
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class RelayTeamConfiguration : IEntityTypeConfiguration<RelayTeam>
{
public void Configure(EntityTypeBuilder<RelayTeam> builder)
{
builder.HasKey(r => r.RelayTeamId);
builder.Property(r => r.Name).IsRequired().HasMaxLength(100);
builder.HasOne(r => r.School).WithMany().HasForeignKey(r => r.SchoolId).OnDelete(DeleteBehavior.Restrict);
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class RelayTeamMemberConfiguration : IEntityTypeConfiguration<RelayTeamMember>
{
public void Configure(EntityTypeBuilder<RelayTeamMember> builder)
{
builder.HasKey(r => r.RelayTeamMemberId);
builder.HasOne(r => r.RelayTeam).WithMany(rt => rt.Members).HasForeignKey(r => r.RelayTeamId).OnDelete(DeleteBehavior.Cascade);
builder.HasOne(r => r.Student).WithMany().HasForeignKey(r => r.StudentId).OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(r => new { r.RelayTeamId, r.StudentId }).IsUnique();
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class RoundConfiguration : IEntityTypeConfiguration<Round>
{
public void Configure(EntityTypeBuilder<Round> builder)
{
builder.HasKey(r => r.RoundId);
builder.Property(r => r.RoundType).HasConversion<string>().HasMaxLength(20);
builder.Property(r => r.Status).HasConversion<string>().HasMaxLength(20);
builder.HasOne(r => r.TournamentEventLevel).WithMany(t => t.Rounds).HasForeignKey(r => r.TournamentEventLevelId).OnDelete(DeleteBehavior.Cascade);
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class SchoolConfiguration : IEntityTypeConfiguration<School>
{
public void Configure(EntityTypeBuilder<School> builder)
{
builder.HasKey(s => s.SchoolId);
builder.Property(s => s.Name).IsRequired().HasMaxLength(200);
builder.Property(s => s.ShortName).HasMaxLength(20);
builder.Property(s => s.SchoolLevel).HasConversion<string>().HasMaxLength(20);
builder.HasOne(s => s.Zone).WithMany(z => z.Schools).HasForeignKey(s => s.ZoneId).OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(s => s.Name).IsUnique();
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class ScoreConfiguration : IEntityTypeConfiguration<Score>
{
public void Configure(EntityTypeBuilder<Score> builder)
{
builder.HasKey(s => s.ScoreId);
builder.Property(s => s.RawPerformance).HasPrecision(10, 3);
builder.Property(s => s.RecordedBy).HasMaxLength(450);
builder.HasOne(s => s.EventRegistration).WithOne(r => r.Score).HasForeignKey<Score>(s => s.EventRegistrationId).OnDelete(DeleteBehavior.Cascade);
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class ScoringConstantConfiguration : IEntityTypeConfiguration<ScoringConstant>
{
public void Configure(EntityTypeBuilder<ScoringConstant> builder)
{
builder.HasKey(s => s.ScoringConstantId);
builder.Property(s => s.A).HasPrecision(18, 6);
builder.Property(s => s.B).HasPrecision(18, 6);
builder.Property(s => s.C).HasPrecision(18, 6);
builder.Property(s => s.Unit).IsRequired().HasMaxLength(20);
builder.HasOne(s => s.Event).WithMany(e => e.ScoringConstants).HasForeignKey(s => s.EventId).OnDelete(DeleteBehavior.Cascade);
}
}

View File

@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class StudentConfiguration : IEntityTypeConfiguration<Student>
{
public void Configure(EntityTypeBuilder<Student> builder)
{
builder.HasKey(s => s.StudentId);
builder.Property(s => s.ExistingStudentId).IsRequired().HasMaxLength(50);
builder.HasIndex(s => s.ExistingStudentId).IsUnique();
builder.Property(s => s.FirstName).IsRequired().HasMaxLength(100);
builder.Property(s => s.LastName).IsRequired().HasMaxLength(100);
builder.Property(s => s.Sex).HasConversion<string>().HasMaxLength(10);
builder.HasOne(s => s.School).WithMany(sc => sc.Students).HasForeignKey(s => s.SchoolId).OnDelete(DeleteBehavior.Restrict);
builder.Ignore(s => s.FullName);
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class TournamentConfiguration : IEntityTypeConfiguration<Tournament>
{
public void Configure(EntityTypeBuilder<Tournament> builder)
{
builder.HasKey(t => t.TournamentId);
builder.Property(t => t.Name).IsRequired().HasMaxLength(200);
builder.Property(t => t.Status).HasConversion<string>().HasMaxLength(20);
builder.Property(t => t.SchoolLevel).HasConversion<string>().HasMaxLength(20);
builder.HasOne(t => t.Zone).WithMany().HasForeignKey(t => t.ZoneId).OnDelete(DeleteBehavior.SetNull);
}
}

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class TournamentEventLevelConfiguration : IEntityTypeConfiguration<TournamentEventLevel>
{
public void Configure(EntityTypeBuilder<TournamentEventLevel> builder)
{
builder.HasKey(t => t.TournamentEventLevelId);
builder.HasIndex(t => new { t.TournamentId, t.EventId, t.EventLevelId }).IsUnique();
builder.HasOne(t => t.Tournament).WithMany(to => to.TournamentEventLevels).HasForeignKey(t => t.TournamentId).OnDelete(DeleteBehavior.Cascade);
builder.HasOne(t => t.Event).WithMany(e => e.TournamentEventLevels).HasForeignKey(t => t.EventId).OnDelete(DeleteBehavior.Restrict);
builder.HasOne(t => t.EventLevel).WithMany(el => el.TournamentEventLevels).HasForeignKey(t => t.EventLevelId).OnDelete(DeleteBehavior.Restrict);
}
}

View File

@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;
namespace SportsDivision.Infrastructure.Data.Configurations;
public class ZoneConfiguration : IEntityTypeConfiguration<Zone>
{
public void Configure(EntityTypeBuilder<Zone> builder)
{
builder.HasKey(z => z.ZoneId);
builder.Property(z => z.Name).IsRequired().HasMaxLength(100);
builder.Property(z => z.Code).IsRequired().HasMaxLength(10);
builder.HasIndex(z => z.Code).IsUnique();
}
}

View File

@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
using SportsDivision.Infrastructure.Identity;
using SportsDivision.Infrastructure.Repositories;
using SportsDivision.Infrastructure.Seeding;
namespace SportsDivision.Infrastructure;
public static class DependencyInjection
{
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql(configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
{
options.Password.RequireDigit = true;
options.Password.RequireLowercase = true;
options.Password.RequireUppercase = true;
options.Password.RequireNonAlphanumeric = true;
options.Password.RequiredLength = 8;
options.User.RequireUniqueEmail = true;
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.ConfigureApplicationCookie(options =>
{
options.LoginPath = "/Account/Login";
options.LogoutPath = "/Account/Logout";
options.AccessDeniedPath = "/Account/AccessDenied";
});
services.AddScoped<IUnitOfWork, UnitOfWork>();
services.AddScoped<DatabaseSeeder>();
return services;
}
}

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Identity;
namespace SportsDivision.Infrastructure.Identity;
public class ApplicationUser : IdentityUser
{
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public int? SchoolId { get; set; }
public bool IsActive { get; set; } = true;
public string FullName => $"{FirstName} {LastName}";
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,894 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace SportsDivision.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AspNetRoles",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AspNetUsers",
columns: table => new
{
Id = table.Column<string>(type: "text", nullable: false),
FirstName = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false),
SchoolId = table.Column<int>(type: "integer", nullable: true),
IsActive = table.Column<bool>(type: "boolean", nullable: false),
UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
PasswordHash = table.Column<string>(type: "text", nullable: true),
SecurityStamp = table.Column<string>(type: "text", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
PhoneNumber = table.Column<string>(type: "text", nullable: true),
PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "EventLevels",
columns: table => new
{
EventLevelId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Sex = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
MaxAge = table.Column<int>(type: "integer", nullable: true),
SchoolLevel = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
IsAgeBased = table.Column<bool>(type: "boolean", nullable: false),
SortOrder = table.Column<int>(type: "integer", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EventLevels", x => x.EventLevelId);
});
migrationBuilder.CreateTable(
name: "Events",
columns: table => new
{
EventId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Category = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
IsRelay = table.Column<bool>(type: "boolean", nullable: false),
PrimarySchool = table.Column<bool>(type: "boolean", nullable: false),
SecondarySchool = table.Column<bool>(type: "boolean", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Events", x => x.EventId);
});
migrationBuilder.CreateTable(
name: "PlacementPointConfigs",
columns: table => new
{
PlacementPointConfigId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Placement = table.Column<int>(type: "integer", nullable: false),
Points = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PlacementPointConfigs", x => x.PlacementPointConfigId);
});
migrationBuilder.CreateTable(
name: "Zones",
columns: table => new
{
ZoneId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Code = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Zones", x => x.ZoneId);
});
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoleId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserClaims",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
UserId = table.Column<string>(type: "text", nullable: false),
ClaimType = table.Column<string>(type: "text", nullable: true),
ClaimValue = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
table.ForeignKey(
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserLogins",
columns: table => new
{
LoginProvider = table.Column<string>(type: "text", nullable: false),
ProviderKey = table.Column<string>(type: "text", nullable: false),
ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
UserId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
table.ForeignKey(
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserRoles",
columns: table => new
{
UserId = table.Column<string>(type: "text", nullable: false),
RoleId = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AspNetUserTokens",
columns: table => new
{
UserId = table.Column<string>(type: "text", nullable: false),
LoginProvider = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
Value = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
table.ForeignKey(
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "EventEventLevel",
columns: table => new
{
EventLevelsEventLevelId = table.Column<int>(type: "integer", nullable: false),
EventsEventId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EventEventLevel", x => new { x.EventLevelsEventLevelId, x.EventsEventId });
table.ForeignKey(
name: "FK_EventEventLevel_EventLevels_EventLevelsEventLevelId",
column: x => x.EventLevelsEventLevelId,
principalTable: "EventLevels",
principalColumn: "EventLevelId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_EventEventLevel_Events_EventsEventId",
column: x => x.EventsEventId,
principalTable: "Events",
principalColumn: "EventId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ScoringConstants",
columns: table => new
{
ScoringConstantId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
EventId = table.Column<int>(type: "integer", nullable: false),
A = table.Column<decimal>(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false),
B = table.Column<decimal>(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false),
C = table.Column<decimal>(type: "numeric(18,6)", precision: 18, scale: 6, nullable: false),
Unit = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ScoringConstants", x => x.ScoringConstantId);
table.ForeignKey(
name: "FK_ScoringConstants_Events_EventId",
column: x => x.EventId,
principalTable: "Events",
principalColumn: "EventId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Schools",
columns: table => new
{
SchoolId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
ShortName = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true),
SchoolLevel = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
ZoneId = table.Column<int>(type: "integer", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Schools", x => x.SchoolId);
table.ForeignKey(
name: "FK_Schools_Zones_ZoneId",
column: x => x.ZoneId,
principalTable: "Zones",
principalColumn: "ZoneId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Tournaments",
columns: table => new
{
TournamentId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
StartDate = table.Column<DateOnly>(type: "date", nullable: false),
EndDate = table.Column<DateOnly>(type: "date", nullable: false),
ZoneId = table.Column<int>(type: "integer", nullable: true),
SchoolLevel = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true),
IsArchived = table.Column<bool>(type: "boolean", nullable: false),
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Tournaments", x => x.TournamentId);
table.ForeignKey(
name: "FK_Tournaments_Zones_ZoneId",
column: x => x.ZoneId,
principalTable: "Zones",
principalColumn: "ZoneId",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "RelayTeams",
columns: table => new
{
RelayTeamId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
SchoolId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RelayTeams", x => x.RelayTeamId);
table.ForeignKey(
name: "FK_RelayTeams_Schools_SchoolId",
column: x => x.SchoolId,
principalTable: "Schools",
principalColumn: "SchoolId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Students",
columns: table => new
{
StudentId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ExistingStudentId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
FirstName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
LastName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
DateOfBirth = table.Column<DateOnly>(type: "date", nullable: false),
Sex = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
SchoolId = table.Column<int>(type: "integer", nullable: false),
IsActive = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Students", x => x.StudentId);
table.ForeignKey(
name: "FK_Students_Schools_SchoolId",
column: x => x.SchoolId,
principalTable: "Schools",
principalColumn: "SchoolId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "TournamentEventLevels",
columns: table => new
{
TournamentEventLevelId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TournamentId = table.Column<int>(type: "integer", nullable: false),
EventId = table.Column<int>(type: "integer", nullable: false),
EventLevelId = table.Column<int>(type: "integer", nullable: false),
AgeRestrictionWaived = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TournamentEventLevels", x => x.TournamentEventLevelId);
table.ForeignKey(
name: "FK_TournamentEventLevels_EventLevels_EventLevelId",
column: x => x.EventLevelId,
principalTable: "EventLevels",
principalColumn: "EventLevelId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_TournamentEventLevels_Events_EventId",
column: x => x.EventId,
principalTable: "Events",
principalColumn: "EventId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_TournamentEventLevels_Tournaments_TournamentId",
column: x => x.TournamentId,
principalTable: "Tournaments",
principalColumn: "TournamentId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RelayTeamMembers",
columns: table => new
{
RelayTeamMemberId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RelayTeamId = table.Column<int>(type: "integer", nullable: false),
StudentId = table.Column<int>(type: "integer", nullable: false),
RunOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RelayTeamMembers", x => x.RelayTeamMemberId);
table.ForeignKey(
name: "FK_RelayTeamMembers_RelayTeams_RelayTeamId",
column: x => x.RelayTeamId,
principalTable: "RelayTeams",
principalColumn: "RelayTeamId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RelayTeamMembers_Students_StudentId",
column: x => x.StudentId,
principalTable: "Students",
principalColumn: "StudentId",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "EventRegistrations",
columns: table => new
{
EventRegistrationId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TournamentEventLevelId = table.Column<int>(type: "integer", nullable: false),
StudentId = table.Column<int>(type: "integer", nullable: true),
RelayTeamId = table.Column<int>(type: "integer", nullable: true),
RegisteredBy = table.Column<string>(type: "character varying(450)", maxLength: 450, nullable: false),
RegisteredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EventRegistrations", x => x.EventRegistrationId);
table.ForeignKey(
name: "FK_EventRegistrations_RelayTeams_RelayTeamId",
column: x => x.RelayTeamId,
principalTable: "RelayTeams",
principalColumn: "RelayTeamId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_EventRegistrations_Students_StudentId",
column: x => x.StudentId,
principalTable: "Students",
principalColumn: "StudentId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_EventRegistrations_TournamentEventLevels_TournamentEventLev~",
column: x => x.TournamentEventLevelId,
principalTable: "TournamentEventLevels",
principalColumn: "TournamentEventLevelId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "HighJumpHeights",
columns: table => new
{
HighJumpHeightId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TournamentEventLevelId = table.Column<int>(type: "integer", nullable: false),
Height = table.Column<decimal>(type: "numeric(5,2)", precision: 5, scale: 2, nullable: false),
SortOrder = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_HighJumpHeights", x => x.HighJumpHeightId);
table.ForeignKey(
name: "FK_HighJumpHeights_TournamentEventLevels_TournamentEventLevelId",
column: x => x.TournamentEventLevelId,
principalTable: "TournamentEventLevels",
principalColumn: "TournamentEventLevelId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Rounds",
columns: table => new
{
RoundId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TournamentEventLevelId = table.Column<int>(type: "integer", nullable: false),
RoundType = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
RoundOrder = table.Column<int>(type: "integer", nullable: false),
AdvanceTopN = table.Column<int>(type: "integer", nullable: true),
AdvanceFastestLosers = table.Column<int>(type: "integer", nullable: true),
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Rounds", x => x.RoundId);
table.ForeignKey(
name: "FK_Rounds_TournamentEventLevels_TournamentEventLevelId",
column: x => x.TournamentEventLevelId,
principalTable: "TournamentEventLevels",
principalColumn: "TournamentEventLevelId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Scores",
columns: table => new
{
ScoreId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
EventRegistrationId = table.Column<int>(type: "integer", nullable: false),
RawPerformance = table.Column<decimal>(type: "numeric(10,3)", precision: 10, scale: 3, nullable: false),
CalculatedPoints = table.Column<int>(type: "integer", nullable: false),
Placement = table.Column<int>(type: "integer", nullable: true),
PlacementPoints = table.Column<int>(type: "integer", nullable: false),
RecordedBy = table.Column<string>(type: "character varying(450)", maxLength: 450, nullable: true),
RecordedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Scores", x => x.ScoreId);
table.ForeignKey(
name: "FK_Scores_EventRegistrations_EventRegistrationId",
column: x => x.EventRegistrationId,
principalTable: "EventRegistrations",
principalColumn: "EventRegistrationId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "HighJumpAttempts",
columns: table => new
{
HighJumpAttemptId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
HighJumpHeightId = table.Column<int>(type: "integer", nullable: false),
EventRegistrationId = table.Column<int>(type: "integer", nullable: false),
Attempt1 = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: true),
Attempt2 = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: true),
Attempt3 = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_HighJumpAttempts", x => x.HighJumpAttemptId);
table.ForeignKey(
name: "FK_HighJumpAttempts_EventRegistrations_EventRegistrationId",
column: x => x.EventRegistrationId,
principalTable: "EventRegistrations",
principalColumn: "EventRegistrationId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_HighJumpAttempts_HighJumpHeights_HighJumpHeightId",
column: x => x.HighJumpHeightId,
principalTable: "HighJumpHeights",
principalColumn: "HighJumpHeightId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Heats",
columns: table => new
{
HeatId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
RoundId = table.Column<int>(type: "integer", nullable: false),
HeatNumber = table.Column<int>(type: "integer", nullable: false),
Status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Heats", x => x.HeatId);
table.ForeignKey(
name: "FK_Heats_Rounds_RoundId",
column: x => x.RoundId,
principalTable: "Rounds",
principalColumn: "RoundId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "HeatLanes",
columns: table => new
{
HeatLaneId = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
HeatId = table.Column<int>(type: "integer", nullable: false),
EventRegistrationId = table.Column<int>(type: "integer", nullable: false),
LaneNumber = table.Column<int>(type: "integer", nullable: false),
Time = table.Column<decimal>(type: "numeric(10,3)", precision: 10, scale: 3, nullable: true),
IsAdvanced = table.Column<bool>(type: "boolean", nullable: false),
AdvanceReason = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true),
IsDNS = table.Column<bool>(type: "boolean", nullable: false),
IsDNF = table.Column<bool>(type: "boolean", nullable: false),
IsDQ = table.Column<bool>(type: "boolean", nullable: false),
RecordedBy = table.Column<string>(type: "character varying(450)", maxLength: 450, nullable: true),
RecordedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_HeatLanes", x => x.HeatLaneId);
table.ForeignKey(
name: "FK_HeatLanes_EventRegistrations_EventRegistrationId",
column: x => x.EventRegistrationId,
principalTable: "EventRegistrations",
principalColumn: "EventRegistrationId",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_HeatLanes_Heats_HeatId",
column: x => x.HeatId,
principalTable: "Heats",
principalColumn: "HeatId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AspNetRoleClaims_RoleId",
table: "AspNetRoleClaims",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "RoleNameIndex",
table: "AspNetRoles",
column: "NormalizedName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_AspNetUserClaims_UserId",
table: "AspNetUserClaims",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserLogins_UserId",
table: "AspNetUserLogins",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AspNetUserRoles_RoleId",
table: "AspNetUserRoles",
column: "RoleId");
migrationBuilder.CreateIndex(
name: "EmailIndex",
table: "AspNetUsers",
column: "NormalizedEmail");
migrationBuilder.CreateIndex(
name: "UserNameIndex",
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_EventEventLevel_EventsEventId",
table: "EventEventLevel",
column: "EventsEventId");
migrationBuilder.CreateIndex(
name: "IX_EventLevels_Name_Sex",
table: "EventLevels",
columns: new[] { "Name", "Sex" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_EventRegistrations_RelayTeamId",
table: "EventRegistrations",
column: "RelayTeamId");
migrationBuilder.CreateIndex(
name: "IX_EventRegistrations_StudentId",
table: "EventRegistrations",
column: "StudentId");
migrationBuilder.CreateIndex(
name: "IX_EventRegistrations_TournamentEventLevelId_StudentId",
table: "EventRegistrations",
columns: new[] { "TournamentEventLevelId", "StudentId" },
unique: true,
filter: "\"StudentId\" IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Events_Name",
table: "Events",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_HeatLanes_EventRegistrationId",
table: "HeatLanes",
column: "EventRegistrationId");
migrationBuilder.CreateIndex(
name: "IX_HeatLanes_HeatId_LaneNumber",
table: "HeatLanes",
columns: new[] { "HeatId", "LaneNumber" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Heats_RoundId",
table: "Heats",
column: "RoundId");
migrationBuilder.CreateIndex(
name: "IX_HighJumpAttempts_EventRegistrationId",
table: "HighJumpAttempts",
column: "EventRegistrationId");
migrationBuilder.CreateIndex(
name: "IX_HighJumpAttempts_HighJumpHeightId_EventRegistrationId",
table: "HighJumpAttempts",
columns: new[] { "HighJumpHeightId", "EventRegistrationId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_HighJumpHeights_TournamentEventLevelId",
table: "HighJumpHeights",
column: "TournamentEventLevelId");
migrationBuilder.CreateIndex(
name: "IX_PlacementPointConfigs_Placement",
table: "PlacementPointConfigs",
column: "Placement",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RelayTeamMembers_RelayTeamId_StudentId",
table: "RelayTeamMembers",
columns: new[] { "RelayTeamId", "StudentId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RelayTeamMembers_StudentId",
table: "RelayTeamMembers",
column: "StudentId");
migrationBuilder.CreateIndex(
name: "IX_RelayTeams_SchoolId",
table: "RelayTeams",
column: "SchoolId");
migrationBuilder.CreateIndex(
name: "IX_Rounds_TournamentEventLevelId",
table: "Rounds",
column: "TournamentEventLevelId");
migrationBuilder.CreateIndex(
name: "IX_Schools_Name",
table: "Schools",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Schools_ZoneId",
table: "Schools",
column: "ZoneId");
migrationBuilder.CreateIndex(
name: "IX_Scores_EventRegistrationId",
table: "Scores",
column: "EventRegistrationId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ScoringConstants_EventId",
table: "ScoringConstants",
column: "EventId");
migrationBuilder.CreateIndex(
name: "IX_Students_ExistingStudentId",
table: "Students",
column: "ExistingStudentId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Students_SchoolId",
table: "Students",
column: "SchoolId");
migrationBuilder.CreateIndex(
name: "IX_TournamentEventLevels_EventId",
table: "TournamentEventLevels",
column: "EventId");
migrationBuilder.CreateIndex(
name: "IX_TournamentEventLevels_EventLevelId",
table: "TournamentEventLevels",
column: "EventLevelId");
migrationBuilder.CreateIndex(
name: "IX_TournamentEventLevels_TournamentId_EventId_EventLevelId",
table: "TournamentEventLevels",
columns: new[] { "TournamentId", "EventId", "EventLevelId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Tournaments_ZoneId",
table: "Tournaments",
column: "ZoneId");
migrationBuilder.CreateIndex(
name: "IX_Zones_Code",
table: "Zones",
column: "Code",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AspNetRoleClaims");
migrationBuilder.DropTable(
name: "AspNetUserClaims");
migrationBuilder.DropTable(
name: "AspNetUserLogins");
migrationBuilder.DropTable(
name: "AspNetUserRoles");
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "EventEventLevel");
migrationBuilder.DropTable(
name: "HeatLanes");
migrationBuilder.DropTable(
name: "HighJumpAttempts");
migrationBuilder.DropTable(
name: "PlacementPointConfigs");
migrationBuilder.DropTable(
name: "RelayTeamMembers");
migrationBuilder.DropTable(
name: "Scores");
migrationBuilder.DropTable(
name: "ScoringConstants");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "AspNetUsers");
migrationBuilder.DropTable(
name: "Heats");
migrationBuilder.DropTable(
name: "HighJumpHeights");
migrationBuilder.DropTable(
name: "EventRegistrations");
migrationBuilder.DropTable(
name: "Rounds");
migrationBuilder.DropTable(
name: "RelayTeams");
migrationBuilder.DropTable(
name: "Students");
migrationBuilder.DropTable(
name: "TournamentEventLevels");
migrationBuilder.DropTable(
name: "Schools");
migrationBuilder.DropTable(
name: "EventLevels");
migrationBuilder.DropTable(
name: "Events");
migrationBuilder.DropTable(
name: "Tournaments");
migrationBuilder.DropTable(
name: "Zones");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Enums;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class EventLevelRepository : Repository<EventLevel>, IEventLevelRepository
{
public EventLevelRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<EventLevel>> GetBySchoolLevelAsync(SchoolLevel level) => await _dbSet.Where(e => e.SchoolLevel == level).OrderBy(e => e.SortOrder).ToListAsync();
public async Task<IEnumerable<EventLevel>> GetBySexAsync(Sex sex) => await _dbSet.Where(e => e.Sex == sex).OrderBy(e => e.SortOrder).ToListAsync();
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class EventRegistrationRepository : Repository<EventRegistration>, IEventRegistrationRepository
{
public EventRegistrationRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<EventRegistration>> GetByTournamentEventLevelAsync(int tournamentEventLevelId) => await _dbSet.Where(r => r.TournamentEventLevelId == tournamentEventLevelId).Include(r => r.Student).ThenInclude(s => s!.School).Include(r => r.Score).ToListAsync();
public async Task<IEnumerable<EventRegistration>> GetByStudentAsync(int studentId) => await _dbSet.Where(r => r.StudentId == studentId).Include(r => r.TournamentEventLevel).ThenInclude(t => t.Event).Include(r => r.TournamentEventLevel).ThenInclude(t => t.EventLevel).Include(r => r.TournamentEventLevel).ThenInclude(t => t.Tournament).Include(r => r.Score).ToListAsync();
public async Task<bool> IsStudentRegisteredAsync(int tournamentEventLevelId, int studentId) => await _dbSet.AnyAsync(r => r.TournamentEventLevelId == tournamentEventLevelId && r.StudentId == studentId);
public async Task<IEnumerable<EventRegistration>> GetBySchoolAndTournamentAsync(int schoolId, int tournamentId) => await _dbSet.Where(r => r.Student != null && r.Student.SchoolId == schoolId && r.TournamentEventLevel.TournamentId == tournamentId).Include(r => r.Student).Include(r => r.TournamentEventLevel).ThenInclude(t => t.Event).Include(r => r.TournamentEventLevel).ThenInclude(t => t.EventLevel).Include(r => r.Score).ToListAsync();
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Enums;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class EventRepository : Repository<Event>, IEventRepository
{
public EventRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<Event>> GetByCategoryAsync(EventCategory category) => await _dbSet.Where(e => e.Category == category).OrderBy(e => e.Name).ToListAsync();
public async Task<Event?> GetWithEventLevelsAsync(int eventId) => await _dbSet.Include(e => e.EventLevels).FirstOrDefaultAsync(e => e.EventId == eventId);
public async Task<IEnumerable<Event>> GetBySchoolLevelAsync(bool primarySchool, bool secondarySchool) => await _dbSet.Where(e => (primarySchool && e.PrimarySchool) || (secondarySchool && e.SecondarySchool)).OrderBy(e => e.Name).ToListAsync();
}

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class HeatLaneRepository : Repository<HeatLane>, IHeatLaneRepository
{
public HeatLaneRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<HeatLane>> GetByHeatAsync(int heatId) =>
await _dbSet.Where(l => l.HeatId == heatId)
.Include(l => l.EventRegistration)
.ThenInclude(r => r.Student!)
.ThenInclude(s => s.School)
.OrderBy(l => l.LaneNumber)
.ToListAsync();
public async Task<HeatLane?> GetWithDetailsAsync(int heatLaneId) =>
await _dbSet
.Include(l => l.EventRegistration)
.ThenInclude(r => r.Student!)
.ThenInclude(s => s.School)
.FirstOrDefaultAsync(l => l.HeatLaneId == heatLaneId);
}

View File

@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class HeatRepository : Repository<Heat>, IHeatRepository
{
public HeatRepository(ApplicationDbContext context) : base(context) { }
public async Task<Heat?> GetWithLanesAsync(int heatId) =>
await _dbSet
.Include(h => h.HeatLanes)
.ThenInclude(l => l.EventRegistration)
.ThenInclude(r => r.Student!)
.ThenInclude(s => s.School)
.FirstOrDefaultAsync(h => h.HeatId == heatId);
}

View File

@@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class HighJumpHeightRepository : Repository<HighJumpHeight>, IHighJumpHeightRepository
{
public HighJumpHeightRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<HighJumpHeight>> GetByTournamentEventLevelAsync(int tournamentEventLevelId) => await _dbSet.Where(h => h.TournamentEventLevelId == tournamentEventLevelId).Include(h => h.Attempts).OrderBy(h => h.SortOrder).ToListAsync();
public async Task<HighJumpHeight?> GetWithAttemptsAsync(int heightId) => await _dbSet.Include(h => h.Attempts).ThenInclude(a => a.EventRegistration).ThenInclude(r => r.Student).ThenInclude(s => s!.School).FirstOrDefaultAsync(h => h.HighJumpHeightId == heightId);
}

View File

@@ -0,0 +1,14 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class PlacementPointConfigRepository : Repository<PlacementPointConfig>, IPlacementPointConfigRepository
{
public PlacementPointConfigRepository(ApplicationDbContext context) : base(context) { }
public async Task<PlacementPointConfig?> GetByPlacementAsync(int placement) =>
await _dbSet.FirstOrDefaultAsync(p => p.Placement == placement);
}

View File

@@ -0,0 +1,28 @@
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class Repository<T> : IRepository<T> where T : class
{
protected readonly ApplicationDbContext _context;
protected readonly DbSet<T> _dbSet;
public Repository(ApplicationDbContext context)
{
_context = context;
_dbSet = context.Set<T>();
}
public async Task<T?> GetByIdAsync(int id) => await _dbSet.FindAsync(id);
public async Task<IEnumerable<T>> GetAllAsync() => await _dbSet.ToListAsync();
public async Task<IEnumerable<T>> FindAsync(Expression<Func<T, bool>> predicate) => await _dbSet.Where(predicate).ToListAsync();
public async Task<T> AddAsync(T entity) { await _dbSet.AddAsync(entity); return entity; }
public async Task AddRangeAsync(IEnumerable<T> entities) => await _dbSet.AddRangeAsync(entities);
public void Update(T entity) => _dbSet.Update(entity);
public void Remove(T entity) => _dbSet.Remove(entity);
public async Task<bool> AnyAsync(Expression<Func<T, bool>> predicate) => await _dbSet.AnyAsync(predicate);
public async Task<int> CountAsync(Expression<Func<T, bool>>? predicate = null) => predicate == null ? await _dbSet.CountAsync() : await _dbSet.CountAsync(predicate);
}

View File

@@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class RoundRepository : Repository<Round>, IRoundRepository
{
public RoundRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<Round>> GetByTournamentEventLevelAsync(int tournamentEventLevelId) => await _dbSet.Where(r => r.TournamentEventLevelId == tournamentEventLevelId).Include(r => r.Heats).OrderBy(r => r.RoundOrder).ToListAsync();
public async Task<Round?> GetWithHeatsAsync(int roundId) => await _dbSet.Include(r => r.Heats).ThenInclude(h => h.HeatLanes).ThenInclude(hl => hl.EventRegistration).ThenInclude(er => er.Student).ThenInclude(s => s!.School).Include(r => r.TournamentEventLevel).ThenInclude(t => t.Event).Include(r => r.TournamentEventLevel).ThenInclude(t => t.EventLevel).FirstOrDefaultAsync(r => r.RoundId == roundId);
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Enums;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class SchoolRepository : Repository<School>, ISchoolRepository
{
public SchoolRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<School>> GetByZoneAsync(int zoneId) => await _dbSet.Where(s => s.ZoneId == zoneId).Include(s => s.Zone).OrderBy(s => s.Name).ToListAsync();
public async Task<IEnumerable<School>> GetBySchoolLevelAsync(SchoolLevel level) => await _dbSet.Where(s => s.SchoolLevel == level).Include(s => s.Zone).OrderBy(s => s.Name).ToListAsync();
public async Task<School?> GetWithStudentsAsync(int schoolId) => await _dbSet.Include(s => s.Students).Include(s => s.Zone).FirstOrDefaultAsync(s => s.SchoolId == schoolId);
}

View File

@@ -0,0 +1,14 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class ScoreRepository : Repository<Score>, IScoreRepository
{
public ScoreRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<Score>> GetByTournamentEventLevelAsync(int tournamentEventLevelId) => await _dbSet.Where(s => s.EventRegistration.TournamentEventLevelId == tournamentEventLevelId).Include(s => s.EventRegistration).ThenInclude(r => r.Student).ThenInclude(s => s!.School).OrderBy(s => s.Placement).ToListAsync();
public async Task<Score?> GetByRegistrationAsync(int eventRegistrationId) => await _dbSet.FirstOrDefaultAsync(s => s.EventRegistrationId == eventRegistrationId);
public async Task<IEnumerable<Score>> GetBySchoolAndTournamentAsync(int schoolId, int tournamentId) => await _dbSet.Where(s => s.EventRegistration.Student != null && s.EventRegistration.Student.SchoolId == schoolId && s.EventRegistration.TournamentEventLevel.TournamentId == tournamentId).Include(s => s.EventRegistration).ThenInclude(r => r.Student).Include(s => s.EventRegistration).ThenInclude(r => r.TournamentEventLevel).ThenInclude(t => t.Event).OrderBy(s => s.Placement).ToListAsync();
}

View File

@@ -0,0 +1,12 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class ScoringConstantRepository : Repository<ScoringConstant>, IScoringConstantRepository
{
public ScoringConstantRepository(ApplicationDbContext context) : base(context) { }
public async Task<ScoringConstant?> GetByEventAsync(int eventId) => await _dbSet.FirstOrDefaultAsync(s => s.EventId == eventId);
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class StudentRepository : Repository<Student>, IStudentRepository
{
public StudentRepository(ApplicationDbContext context) : base(context) { }
public async Task<Student?> GetByExistingIdAsync(string existingStudentId) => await _dbSet.Include(s => s.School).FirstOrDefaultAsync(s => s.ExistingStudentId == existingStudentId);
public async Task<IEnumerable<Student>> GetBySchoolAsync(int schoolId) => await _dbSet.Where(s => s.SchoolId == schoolId).Include(s => s.School).OrderBy(s => s.LastName).ThenBy(s => s.FirstName).ToListAsync();
public async Task<Student?> GetWithRegistrationsAsync(int studentId) => await _dbSet.Include(s => s.School).Include(s => s.Registrations).ThenInclude(r => r.TournamentEventLevel).ThenInclude(t => t.Event).Include(s => s.Registrations).ThenInclude(r => r.TournamentEventLevel).ThenInclude(t => t.EventLevel).FirstOrDefaultAsync(s => s.StudentId == studentId);
public async Task<IEnumerable<Student>> SearchAsync(string searchTerm) => await _dbSet.Include(s => s.School).Where(s => s.FirstName.Contains(searchTerm) || s.LastName.Contains(searchTerm) || s.ExistingStudentId.Contains(searchTerm)).OrderBy(s => s.LastName).ThenBy(s => s.FirstName).Take(50).ToListAsync();
}

View File

@@ -0,0 +1,15 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class TournamentEventLevelRepository : Repository<TournamentEventLevel>, ITournamentEventLevelRepository
{
public TournamentEventLevelRepository(ApplicationDbContext context) : base(context) { }
public async Task<TournamentEventLevel?> GetWithRegistrationsAsync(int id) => await _dbSet.Include(t => t.Registrations).ThenInclude(r => r.Student).ThenInclude(s => s!.School).Include(t => t.Event).Include(t => t.EventLevel).Include(t => t.Tournament).FirstOrDefaultAsync(t => t.TournamentEventLevelId == id);
public async Task<TournamentEventLevel?> GetWithRoundsAsync(int id) => await _dbSet.Include(t => t.Rounds).ThenInclude(r => r.Heats).ThenInclude(h => h.HeatLanes).ThenInclude(hl => hl.EventRegistration).ThenInclude(r => r.Student).Include(t => t.Event).Include(t => t.EventLevel).Include(t => t.Tournament).FirstOrDefaultAsync(t => t.TournamentEventLevelId == id);
public async Task<IEnumerable<TournamentEventLevel>> GetByTournamentAsync(int tournamentId) => await _dbSet.Where(t => t.TournamentId == tournamentId).Include(t => t.Event).Include(t => t.EventLevel).Include(t => t.Registrations).Include(t => t.Rounds).OrderBy(t => t.EventLevel.SortOrder).ThenBy(t => t.Event.Name).ToListAsync();
public async Task<TournamentEventLevel?> FindAsync(int tournamentId, int eventId, int eventLevelId) => await _dbSet.FirstOrDefaultAsync(t => t.TournamentId == tournamentId && t.EventId == eventId && t.EventLevelId == eventLevelId);
}

View File

@@ -0,0 +1,14 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class TournamentRepository : Repository<Tournament>, ITournamentRepository
{
public TournamentRepository(ApplicationDbContext context) : base(context) { }
public async Task<IEnumerable<Tournament>> GetActiveAsync() => await _dbSet.Where(t => !t.IsArchived).Include(t => t.Zone).OrderByDescending(t => t.StartDate).ToListAsync();
public async Task<Tournament?> GetWithEventLevelsAsync(int tournamentId) => await _dbSet.Include(t => t.TournamentEventLevels).ThenInclude(te => te.Event).Include(t => t.TournamentEventLevels).ThenInclude(te => te.EventLevel).Include(t => t.Zone).FirstOrDefaultAsync(t => t.TournamentId == tournamentId);
public async Task<Tournament?> GetFullTournamentAsync(int tournamentId) => await _dbSet.Include(t => t.Zone).Include(t => t.TournamentEventLevels).ThenInclude(te => te.Event).Include(t => t.TournamentEventLevels).ThenInclude(te => te.EventLevel).Include(t => t.TournamentEventLevels).ThenInclude(te => te.Registrations).ThenInclude(r => r.Student).ThenInclude(s => s!.School).FirstOrDefaultAsync(t => t.TournamentId == tournamentId);
}

View File

@@ -0,0 +1,45 @@
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class UnitOfWork : IUnitOfWork
{
private readonly ApplicationDbContext _context;
public UnitOfWork(ApplicationDbContext context)
{
_context = context;
Zones = new ZoneRepository(context);
Schools = new SchoolRepository(context);
Students = new StudentRepository(context);
Events = new EventRepository(context);
EventLevels = new EventLevelRepository(context);
Tournaments = new TournamentRepository(context);
TournamentEventLevels = new TournamentEventLevelRepository(context);
EventRegistrations = new EventRegistrationRepository(context);
Scores = new ScoreRepository(context);
Rounds = new RoundRepository(context);
Heats = new HeatRepository(context);
HeatLanes = new HeatLaneRepository(context);
HighJumpHeights = new HighJumpHeightRepository(context);
ScoringConstants = new ScoringConstantRepository(context);
PlacementPointConfigs = new PlacementPointConfigRepository(context);
}
public IZoneRepository Zones { get; }
public ISchoolRepository Schools { get; }
public IStudentRepository Students { get; }
public IEventRepository Events { get; }
public IEventLevelRepository EventLevels { get; }
public ITournamentRepository Tournaments { get; }
public ITournamentEventLevelRepository TournamentEventLevels { get; }
public IEventRegistrationRepository EventRegistrations { get; }
public IScoreRepository Scores { get; }
public IRoundRepository Rounds { get; }
public IHeatRepository Heats { get; }
public IHeatLaneRepository HeatLanes { get; }
public IHighJumpHeightRepository HighJumpHeights { get; }
public IScoringConstantRepository ScoringConstants { get; }
public IPlacementPointConfigRepository PlacementPointConfigs { get; }
public async Task<int> SaveChangesAsync() => await _context.SaveChangesAsync();
public void Dispose() => _context.Dispose();
}

View File

@@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Interfaces;
using SportsDivision.Infrastructure.Data;
namespace SportsDivision.Infrastructure.Repositories;
public class ZoneRepository : Repository<Zone>, IZoneRepository
{
public ZoneRepository(ApplicationDbContext context) : base(context) { }
public async Task<Zone?> GetByCodeAsync(string code) => await _dbSet.FirstOrDefaultAsync(z => z.Code == code);
public async Task<IEnumerable<Zone>> GetAllWithSchoolsAsync() => await _dbSet.Include(z => z.Schools).OrderBy(z => z.Name).ToListAsync();
}

View File

@@ -0,0 +1,277 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using SportsDivision.Domain.Entities;
using SportsDivision.Domain.Enums;
using SportsDivision.Infrastructure.Data;
using SportsDivision.Infrastructure.Identity;
namespace SportsDivision.Infrastructure.Seeding;
public class DatabaseSeeder
{
private readonly ApplicationDbContext _context;
private readonly UserManager<ApplicationUser> _userManager;
private readonly RoleManager<IdentityRole> _roleManager;
public DatabaseSeeder(ApplicationDbContext context, UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> roleManager)
{
_context = context;
_userManager = userManager;
_roleManager = roleManager;
}
public async Task SeedAsync()
{
await _context.Database.MigrateAsync();
await SeedRolesAsync();
await SeedAdminUserAsync();
await SeedZonesAsync();
await SeedSchoolsAsync();
await SeedEventLevelsAsync();
await SeedEventsAsync();
await SeedScoringConstantsAsync();
await SeedPlacementPointsAsync();
}
private async Task SeedRolesAsync()
{
string[] roles = { "Admin", "Official", "Coach", "Principal", "Student" };
foreach (var role in roles)
if (!await _roleManager.RoleExistsAsync(role))
await _roleManager.CreateAsync(new IdentityRole(role));
}
private async Task SeedAdminUserAsync()
{
if (await _userManager.FindByEmailAsync("admin@sportsdivision.dm") != null) return;
var admin = new ApplicationUser
{
UserName = "admin@sportsdivision.dm",
Email = "admin@sportsdivision.dm",
FirstName = "System",
LastName = "Administrator",
EmailConfirmed = true,
IsActive = true
};
var result = await _userManager.CreateAsync(admin, "Admin@123!");
if (result.Succeeded) await _userManager.AddToRoleAsync(admin, "Admin");
}
private async Task SeedZonesAsync()
{
if (await _context.Zones.AnyAsync()) return;
await _context.Zones.AddRangeAsync(new List<Zone>
{
new() { Name = "North West", Code = "NW" },
new() { Name = "North", Code = "N" },
new() { Name = "South", Code = "S" },
new() { Name = "South East", Code = "SE" },
new() { Name = "North East", Code = "NE" },
new() { Name = "South West", Code = "SW" },
new() { Name = "West Central", Code = "WC" },
new() { Name = "Secondary School / College", Code = "SSC" }
});
await _context.SaveChangesAsync();
}
private async Task SeedSchoolsAsync()
{
if (await _context.Schools.AnyAsync()) return;
var zones = await _context.Zones.ToDictionaryAsync(z => z.Code, z => z.ZoneId);
var schools = new List<School>
{
new() { Name = "Academic School of Learning", ShortName = "ACADEMIX", SchoolLevel = SchoolLevel.College, ZoneId = zones["SSC"] },
new() { Name = "Arthur Waldron Seventh-day Adventist Academy", ShortName = "AWSDAA", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Business Training Center", ShortName = "BTC", SchoolLevel = SchoolLevel.College, ZoneId = zones["SSC"] },
new() { Name = "Castle Bruce Secondary School", ShortName = "CBSS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Convent High School", ShortName = "CHS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Dominica Community High School", ShortName = "DCHS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Dominica Grammar School", ShortName = "DGS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Dominica State College", ShortName = "DSC", SchoolLevel = SchoolLevel.College, ZoneId = zones["SSC"] },
new() { Name = "Goodwill Secondary School", ShortName = "GSS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Isaiah Thomas Secondary School", ShortName = "ITSS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "North East Comprehensive School", ShortName = "NECS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Orion Academy", ShortName = "ORION", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Pierre Charles Secondary School", ShortName = "PCSS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Portsmouth Secondary School", ShortName = "PSS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "St Martin's Secondary School", ShortName = "SMSS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "St Mary's Academy", ShortName = "SMA", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Wesley High School", ShortName = "WHS", SchoolLevel = SchoolLevel.Secondary, ZoneId = zones["SSC"] },
new() { Name = "Cambell Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Colihaut Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Coulibistrie Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Dublanc Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Kelleb Laurent Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Mahaut Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Salisbury Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Warner Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NW"] },
new() { Name = "Baroness Patricia Scotland Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Bense Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Clifton Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Paix Bouche Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Penville Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Roosevelt Douglas Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Savanne Paille Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "St. John's Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Thibaud Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["N"] },
new() { Name = "Atkinson Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Calibishie Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Concord Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Lighthouse Christian Academy", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Salybia Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Wesley Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Wills Stratmore Steven Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Woodford Hill Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["NE"] },
new() { Name = "Belles Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "Castle Bruce Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "Delices Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "Grand Fond Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "Jones Beaupierre Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "Morne Jaune Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "San Sauver Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "Sineku Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SE"] },
new() { Name = "Bagatelle Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["S"] },
new() { Name = "Bellevue Chopin Primary", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["S"] },
new() { Name = "Grand Bay Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["S"] },
new() { Name = "Petite Savanne Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["S"] },
new() { Name = "Tete Morne Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["S"] },
new() { Name = "Giraudel Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SW"] },
new() { Name = "Morne Prosper Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SW"] },
new() { Name = "Newtown Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SW"] },
new() { Name = "Soufriere Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SW"] },
new() { Name = "St. Luke's Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SW"] },
new() { Name = "Trafalgar Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SW"] },
new() { Name = "Wotton Waven Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["SW"] },
new() { Name = "Berean Academy", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["WC"] },
new() { Name = "Christian Union Primary", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["WC"] },
new() { Name = "Goodwill Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["WC"] },
new() { Name = "Massacre Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["WC"] },
new() { Name = "Pioneer Preparatory", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["WC"] },
new() { Name = "St. Martin's Primary School", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["WC"] },
new() { Name = "St. Mary's Primary", SchoolLevel = SchoolLevel.Primary, ZoneId = zones["WC"] },
};
await _context.Schools.AddRangeAsync(schools);
await _context.SaveChangesAsync();
}
private async Task SeedEventLevelsAsync()
{
if (await _context.EventLevels.AnyAsync()) return;
await _context.EventLevels.AddRangeAsync(new List<EventLevel>
{
new() { Name = "Junior Boys", Sex = Sex.Male, SchoolLevel = SchoolLevel.Primary, IsAgeBased = false, SortOrder = 1 },
new() { Name = "Junior Girls", Sex = Sex.Female, SchoolLevel = SchoolLevel.Primary, IsAgeBased = false, SortOrder = 2 },
new() { Name = "Senior Boys", Sex = Sex.Male, SchoolLevel = SchoolLevel.Primary, IsAgeBased = false, SortOrder = 3 },
new() { Name = "Senior Girls", Sex = Sex.Female, SchoolLevel = SchoolLevel.Primary, IsAgeBased = false, SortOrder = 4 },
new() { Name = "Under 14 Boys", Sex = Sex.Male, MaxAge = 13, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 5 },
new() { Name = "Under 14 Girls", Sex = Sex.Female, MaxAge = 13, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 6 },
new() { Name = "Under 15 Boys", Sex = Sex.Male, MaxAge = 14, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 7 },
new() { Name = "Under 15 Girls", Sex = Sex.Female, MaxAge = 14, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 8 },
new() { Name = "Under 16 Boys", Sex = Sex.Male, MaxAge = 15, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 9 },
new() { Name = "Under 16 Girls", Sex = Sex.Female, MaxAge = 15, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 10 },
new() { Name = "Under 17 Boys", Sex = Sex.Male, MaxAge = 16, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 11 },
new() { Name = "Under 17 Girls", Sex = Sex.Female, MaxAge = 16, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 12 },
new() { Name = "Under 20 Boys", Sex = Sex.Male, MaxAge = 19, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 13 },
new() { Name = "Under 20 Girls", Sex = Sex.Female, MaxAge = 19, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 14 },
new() { Name = "Under 21 Boys", Sex = Sex.Male, MaxAge = 20, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 15 },
new() { Name = "Under 21 Girls", Sex = Sex.Female, MaxAge = 20, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 16 },
new() { Name = "Open Boys", Sex = Sex.Male, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 17 },
new() { Name = "Open Girls", Sex = Sex.Female, SchoolLevel = SchoolLevel.Secondary, IsAgeBased = true, SortOrder = 18 },
});
await _context.SaveChangesAsync();
}
private async Task SeedEventsAsync()
{
if (await _context.Events.AnyAsync()) return;
var events = new List<Event>
{
new() { Name = "80m", Category = EventCategory.Track, PrimarySchool = true, SecondarySchool = false },
new() { Name = "100m", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "150m", Category = EventCategory.Track, PrimarySchool = true, SecondarySchool = false },
new() { Name = "200m", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "300m", Category = EventCategory.Track, PrimarySchool = true, SecondarySchool = false },
new() { Name = "400m", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "800m", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "1200m", Category = EventCategory.Track, PrimarySchool = true, SecondarySchool = false },
new() { Name = "1500m", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "3000m", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "5000m", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "80mH", Category = EventCategory.Track, PrimarySchool = false, SecondarySchool = true },
new() { Name = "4X80m Relay", Category = EventCategory.Track, IsRelay = true, PrimarySchool = true, SecondarySchool = false },
new() { Name = "4X100m Relay", Category = EventCategory.Track, IsRelay = true, PrimarySchool = false, SecondarySchool = true },
new() { Name = "4X400m", Category = EventCategory.Track, IsRelay = true, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Long Jump", Category = EventCategory.Field, PrimarySchool = true, SecondarySchool = true },
new() { Name = "Triple Jump", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Shot Put 3kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Shot Put 4kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Shot Put 5kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Shot Put 6kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Discus 1kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Discus 1.25kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Discus 1.5kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Discus 1.75kg", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Javelin 400g", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Javelin 500g", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Javelin 600g", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Javelin 700g", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Javelin 800g", Category = EventCategory.Field, PrimarySchool = false, SecondarySchool = true },
new() { Name = "Throwing the Cricket Ball", Category = EventCategory.Field, PrimarySchool = true, SecondarySchool = false },
new() { Name = "High Jump", Category = EventCategory.HighJump, PrimarySchool = true, SecondarySchool = true },
};
await _context.Events.AddRangeAsync(events);
await _context.SaveChangesAsync();
var allEvents = await _context.Events.ToListAsync();
var primaryLevels = await _context.EventLevels.Where(l => l.SchoolLevel == SchoolLevel.Primary).ToListAsync();
var secondaryLevels = await _context.EventLevels.Where(l => l.SchoolLevel == SchoolLevel.Secondary).ToListAsync();
foreach (var evt in allEvents)
{
if (evt.PrimarySchool) foreach (var level in primaryLevels) evt.EventLevels.Add(level);
if (evt.SecondarySchool) foreach (var level in secondaryLevels) evt.EventLevels.Add(level);
}
await _context.SaveChangesAsync();
}
private async Task SeedScoringConstantsAsync()
{
if (await _context.ScoringConstants.AnyAsync()) return;
var events = await _context.Events.ToListAsync();
var constants = new List<ScoringConstant>();
void Add(string name, decimal a, decimal b, decimal c, string unit)
{
var e = events.FirstOrDefault(ev => ev.Name == name);
if (e != null) constants.Add(new ScoringConstant { EventId = e.EventId, A = a, B = b, C = c, Unit = unit });
}
Add("100m", 25.4347m, 18m, 1.81m, "seconds");
Add("400m", 1.53775m, 82m, 1.81m, "seconds");
Add("1500m", 0.03768m, 480m, 1.85m, "seconds");
Add("80mH", 5.74352m, 28.5m, 1.92m, "seconds");
Add("Long Jump", 0.14354m, 220m, 1.4m, "centimetres");
Add("Triple Jump", 0.14354m, 220m, 1.4m, "centimetres");
Add("High Jump", 0.8465m, 75m, 1.42m, "centimetres");
Add("Shot Put 3kg", 51.39m, 1.5m, 1.05m, "metres"); Add("Shot Put 4kg", 51.39m, 1.5m, 1.05m, "metres");
Add("Shot Put 5kg", 51.39m, 1.5m, 1.05m, "metres"); Add("Shot Put 6kg", 51.39m, 1.5m, 1.05m, "metres");
Add("Discus 1kg", 12.91m, 4m, 1.1m, "metres"); Add("Discus 1.25kg", 12.91m, 4m, 1.1m, "metres");
Add("Discus 1.5kg", 12.91m, 4m, 1.1m, "metres"); Add("Discus 1.75kg", 12.91m, 4m, 1.1m, "metres");
Add("Javelin 400g", 10.14m, 7m, 1.08m, "metres"); Add("Javelin 500g", 10.14m, 7m, 1.08m, "metres");
Add("Javelin 600g", 10.14m, 7m, 1.08m, "metres"); Add("Javelin 700g", 10.14m, 7m, 1.08m, "metres");
Add("Javelin 800g", 10.14m, 7m, 1.08m, "metres");
await _context.ScoringConstants.AddRangeAsync(constants);
await _context.SaveChangesAsync();
}
private async Task SeedPlacementPointsAsync()
{
if (await _context.PlacementPointConfigs.AnyAsync()) return;
await _context.PlacementPointConfigs.AddRangeAsync(new List<PlacementPointConfig>
{
new() { Placement = 1, Points = 10 }, new() { Placement = 2, Points = 8 },
new() { Placement = 3, Points = 6 }, new() { Placement = 4, Points = 5 },
new() { Placement = 5, Points = 4 }, new() { Placement = 6, Points = 3 },
new() { Placement = 7, Points = 2 }, new() { Placement = 8, Points = 1 },
});
await _context.SaveChangesAsync();
}
}

View File

@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SportsDivision.Domain\SportsDivision.Domain.csproj" />
<ProjectReference Include="..\SportsDivision.Application\SportsDivision.Application.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.*" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Utilities.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Tasks.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.IO.Redist" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.1.0.0" newVersion="6.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,171 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost/5.0.0-2.25567.12": {
"dependencies": {
"Microsoft.Build.Locator": "1.10.2",
"Newtonsoft.Json": "13.0.3",
"System.Collections.Immutable": "9.0.0",
"System.CommandLine": "2.0.0-rtm.25509.106"
},
"runtime": {
"Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.dll": {}
},
"resources": {
"cs/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "cs"
},
"de/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "de"
},
"es/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "es"
},
"fr/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "fr"
},
"it/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "it"
},
"ja/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "ja"
},
"ko/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "ko"
},
"pl/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "pl"
},
"pt-BR/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "pt-BR"
},
"ru/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "ru"
},
"tr/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "tr"
},
"zh-Hans/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "zh-Hans"
},
"zh-Hant/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.Build.Locator/1.10.2": {
"runtime": {
"lib/net8.0/Microsoft.Build.Locator.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.10.2.26959"
}
}
},
"Newtonsoft.Json/13.0.3": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.3.27908"
}
}
},
"System.Collections.Immutable/9.0.0": {
"runtime": {
"lib/net8.0/System.Collections.Immutable.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.24.52809"
}
}
},
"System.CommandLine/2.0.0-rtm.25509.106": {
"runtime": {
"lib/net8.0/System.CommandLine.dll": {
"assemblyVersion": "2.0.0.0",
"fileVersion": "2.0.25.51006"
}
},
"resources": {
"lib/net8.0/cs/System.CommandLine.resources.dll": {
"locale": "cs"
},
"lib/net8.0/de/System.CommandLine.resources.dll": {
"locale": "de"
},
"lib/net8.0/es/System.CommandLine.resources.dll": {
"locale": "es"
},
"lib/net8.0/fr/System.CommandLine.resources.dll": {
"locale": "fr"
},
"lib/net8.0/it/System.CommandLine.resources.dll": {
"locale": "it"
},
"lib/net8.0/ja/System.CommandLine.resources.dll": {
"locale": "ja"
},
"lib/net8.0/ko/System.CommandLine.resources.dll": {
"locale": "ko"
},
"lib/net8.0/pl/System.CommandLine.resources.dll": {
"locale": "pl"
},
"lib/net8.0/pt-BR/System.CommandLine.resources.dll": {
"locale": "pt-BR"
},
"lib/net8.0/ru/System.CommandLine.resources.dll": {
"locale": "ru"
},
"lib/net8.0/tr/System.CommandLine.resources.dll": {
"locale": "tr"
},
"lib/net8.0/zh-Hans/System.CommandLine.resources.dll": {
"locale": "zh-Hans"
},
"lib/net8.0/zh-Hant/System.CommandLine.resources.dll": {
"locale": "zh-Hant"
}
}
}
}
},
"libraries": {
"Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost/5.0.0-2.25567.12": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.Build.Locator/1.10.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-F+nLS7IpgtslyxNvtD6Jalnf5WU08lu8yfJBNQl3cbEF3AMUphs4t7nPuRYaaU8QZyGrqtVi7i73LhAe/yHx7A==",
"path": "microsoft.build.locator/1.10.2",
"hashPath": "microsoft.build.locator.1.10.2.nupkg.sha512"
},
"Newtonsoft.Json/13.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
"path": "newtonsoft.json/13.0.3",
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
},
"System.Collections.Immutable/9.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-QhkXUl2gNrQtvPmtBTQHb0YsUrDiDQ2QS09YbtTTiSjGcf7NBqtYbrG/BE06zcBPCKEwQGzIv13IVdXNOSub2w==",
"path": "system.collections.immutable/9.0.0",
"hashPath": "system.collections.immutable.9.0.0.nupkg.sha512"
},
"System.CommandLine/2.0.0-rtm.25509.106": {
"type": "package",
"serviceable": true,
"sha512": "sha512-IdCQOFNHQfK0hu3tzWOHFJLMaiEOR/4OynmOh+IfukrTIsCR4TTDm7lpuXQyMZ0eRfIyUcz06gHGJNlILAq/6A==",
"path": "system.commandline/2.0.0-rtm.25509.106",
"hashPath": "system.commandline.2.0.0-rtm.25509.106.nupkg.sha512"
}
}
}

View File

@@ -0,0 +1,14 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"rollForward": "Major",
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}