Dockerized again...

This commit is contained in:
lumijiez
2025-06-03 20:49:39 +03:00
parent 6a675ac111
commit 735f419cd7
22 changed files with 690 additions and 5770 deletions

View File

@@ -35,11 +35,6 @@ public class OrderConfiguration : EntityBaseConfiguration<Order>
builder.Property(o => o.Notes)
.HasMaxLength(1000);
builder.HasOne<ApplicationUser>()
.WithMany(u => u.Orders)
.HasForeignKey(o => o.UserId)
.OnDelete(DeleteBehavior.Restrict);
builder.HasOne(o => o.OrderStatus)
.WithMany(os => os.Orders)
.HasForeignKey(o => o.OrderStatusId)

View File

@@ -45,11 +45,6 @@ public class AddressConfiguration : EntityBaseConfiguration<Address>
.IsRequired()
.HasDefaultValue(true);
builder.HasOne<ApplicationUser>()
.WithMany(u => u.Addresses)
.HasForeignKey(a => a.UserId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasIndex(a => a.UserId)
.HasDatabaseName("IX_Address_UserId");

View File

@@ -1,66 +0,0 @@
using Imprink.Domain.Entities.Users;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Imprink.Infrastructure.Configuration.Users;
public class ApplicationRoleConfiguration : IEntityTypeConfiguration<ApplicationRole>
{
public void Configure(EntityTypeBuilder<ApplicationRole> builder)
{
builder.Property(r => r.Description)
.HasMaxLength(500);
builder.Property(r => r.CreatedAt)
.IsRequired()
.HasDefaultValueSql("GETUTCDATE()");
builder.Property(r => r.IsActive)
.IsRequired()
.HasDefaultValue(true);
builder.HasIndex(r => r.IsActive)
.HasDatabaseName("IX_ApplicationRole_IsActive");
var seedDate = new DateTime(2025, 1, 1, 0, 0, 0, DateTimeKind.Utc);
builder.HasData(
new ApplicationRole
{
Id = "1",
Name = "Administrator",
NormalizedName = "ADMINISTRATOR",
Description = "Full system access",
CreatedAt = seedDate,
IsActive = true
},
new ApplicationRole
{
Id = "2",
Name = "Customer",
NormalizedName = "CUSTOMER",
Description = "Standard customer access",
CreatedAt = seedDate,
IsActive = true
},
new ApplicationRole
{
Id = "3",
Name = "OrderManager",
NormalizedName = "ORDERMANAGER",
Description = "Manage orders and fulfillment",
CreatedAt = seedDate,
IsActive = true
},
new ApplicationRole
{
Id = "4",
Name = "ProductManager",
NormalizedName = "PRODUCTMANAGER",
Description = "Manage products and inventory",
CreatedAt = seedDate,
IsActive = true
}
);
}
}

View File

@@ -1,30 +0,0 @@
using Imprink.Domain.Entities.Users;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Imprink.Infrastructure.Configuration.Users;
public class ApplicationUserConfiguration : IEntityTypeConfiguration<ApplicationUser>
{
public void Configure(EntityTypeBuilder<ApplicationUser> builder)
{
builder.Property(u => u.FirstName)
.HasMaxLength(100);
builder.Property(u => u.LastName)
.HasMaxLength(100);
builder.Property(u => u.ProfileImageUrl)
.HasMaxLength(500);
builder.Property(u => u.CreatedAt)
.IsRequired()
.HasDefaultValueSql("GETUTCDATE()");
builder.Property(u => u.LastLoginAt)
.HasDefaultValueSql("GETUTCDATE()");
builder.Property(u => u.IsActive)
.HasDefaultValue(true);
}
}