Rebadge the rest of the files

This commit is contained in:
lumijiez
2025-06-03 18:24:40 +03:00
parent 1b6f69fcf9
commit 6a675ac111
77 changed files with 5931 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
using Imprink.Domain.Entities.Users;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Imprink.Infrastructure.Configuration.Users;
public class AddressConfiguration : EntityBaseConfiguration<Address>
{
public override void Configure(EntityTypeBuilder<Address> builder)
{
base.Configure(builder);
builder.Property(a => a.UserId)
.IsRequired()
.HasMaxLength(450);
builder.Property(a => a.AddressType)
.IsRequired()
.HasMaxLength(50);
builder.Property(a => a.Street)
.IsRequired()
.HasMaxLength(200);
builder.Property(a => a.City)
.IsRequired()
.HasMaxLength(100);
builder.Property(a => a.State)
.HasMaxLength(100);
builder.Property(a => a.PostalCode)
.IsRequired()
.HasMaxLength(20);
builder.Property(a => a.Country)
.IsRequired()
.HasMaxLength(100);
builder.Property(a => a.IsDefault)
.IsRequired()
.HasDefaultValue(false);
builder.Property(a => a.IsActive)
.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");
builder.HasIndex(a => new { a.UserId, a.AddressType })
.HasDatabaseName("IX_Address_User_Type");
builder.HasIndex(a => new { a.UserId, a.IsDefault })
.HasDatabaseName("IX_Address_User_Default");
}
}

View File

@@ -0,0 +1,66 @@
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

@@ -0,0 +1,30 @@
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);
}
}