Split Features to create space for more projects
continuous-integration/drone/pr Build is passing

This commit is contained in:
Khwezi Mngoma
2026-05-24 13:19:09 +02:00
parent 032b9e1818
commit 70c6e0bfbc
95 changed files with 621 additions and 314 deletions
@@ -0,0 +1,26 @@
namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities;
public class ShoppingCartConfiguration : IEntityTypeConfiguration<ShoppingCart>
{
public void Configure(EntityTypeBuilder<ShoppingCart> builder)
{
builder.ToTable("ShoppingCarts");
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
builder.Property(f => f.UpdatedAt).IsRequired(false).HasDefaultValueSql(null);
builder.Property(f => f.CustomerId).IsRequired();
builder.Property(f => f.OrderId);
builder.HasOne(s => s.Customer)
.WithMany(c => c.ShoppingCarts)
.HasForeignKey(s => s.CustomerId)
.IsRequired()
.OnDelete(DeleteBehavior.Cascade);
builder.HasOne(s => s.Order)
.WithOne(o => o.ShoppingCart)
.HasForeignKey<ShoppingCart>(s => s.OrderId)
.OnDelete(DeleteBehavior.SetNull);
}
}