Retructured solution

This commit is contained in:
Khwezi Mngoma
2026-05-13 20:06:24 +02:00
parent 26075cd9a7
commit a42c51d7b2
231 changed files with 1618 additions and 1408 deletions
@@ -0,0 +1,15 @@
using LiteCharms.Features.Shop.Customers.Entities;
using LiteCharms.Features.Shop.Orders.Entities;
using LiteCharms.Features.Shop.ShoppingCarts.Entities;
namespace LiteCharms.Features.Shop.Quotes.Entities;
[EntityTypeConfiguration<QuoteConfiguration, Quote>]
public class Quote : Models.Quote
{
public virtual Customer? Customer { get; set; }
public virtual Order? Order { get; set; }
public virtual ShoppingCart? ShoppingCart { get; set; }
}
@@ -0,0 +1,33 @@
namespace LiteCharms.Features.Shop.Quotes.Entities;
public class QuoteConfiguration : IEntityTypeConfiguration<Quote>
{
public void Configure(EntityTypeBuilder<Quote> builder)
{
builder.ToTable(nameof(Quote));
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
builder.Property(f => f.UpdatedAt).IsRequired(false);
builder.Property(f => f.ExpiredAt).IsRequired(false);
builder.Property(f => f.CustomerId).IsRequired();
builder.Property(f => f.OrderId);
builder.Property(f => f.ShoppingCartId);
builder.Property(f => f.Status).IsRequired().HasConversion<int>();
builder.Property(f => f.InvoiceUrl).IsRequired(false).HasMaxLength(2048);
builder.Property(f => f.Reason).IsRequired(false);
builder.HasOne(q => q.Customer)
.WithMany(c => c.Quotes)
.HasForeignKey(q => q.CustomerId)
.IsRequired();
builder.HasOne(q => q.Order)
.WithOne(o => o.Quote)
.HasForeignKey<Quote>(q => q.OrderId);
builder.HasOne(q => q.ShoppingCart)
.WithOne(o => o.Quote)
.HasForeignKey<Quote>(q => q.ShoppingCartId);
}
}