Fix db seeding, migration, repository services

This commit is contained in:
danial23 2025-05-19 22:22:33 -04:00
parent 872dc1e263
commit 6b87902ca7
Signed by: danial23
SSH key fingerprint: SHA256:IJ8VP0j2WMUVweTYnzUUnEjNgPnGx+mAt+RhqWZ01bU
22 changed files with 606 additions and 64 deletions

View file

@ -0,0 +1,92 @@
// <auto-generated />
using CSR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CSR.Infrastructure.Migrations
{
[DbContext(typeof(CSRDbContext))]
[Migration("20250520020330_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.5");
modelBuilder.Entity("CSR.Infrastructure.Persistence.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasColumnName("RoleId");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("RoleName");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Roles");
});
modelBuilder.Entity("CSR.Infrastructure.Persistence.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnName("Password");
b.Property<int>("RoleId")
.HasColumnType("INTEGER");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("CSR.Infrastructure.Persistence.User", b =>
{
b.HasOne("CSR.Infrastructure.Persistence.Role", "Role")
.WithMany("Users")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
});
modelBuilder.Entity("CSR.Infrastructure.Persistence.Role", b =>
{
b.Navigation("Users");
});
#pragma warning restore 612, 618
}
}
}