Added notifications
Added shopping cart and items Added quotes Refactored relatinoships Migrated changes Refactored cqrs commands and queries Refactored mappings
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
namespace LiteCharms.Entities.Configuration;
|
||||
|
||||
public class ShoppingCartConfiguration : IEntityTypeConfiguration<ShoppingCart>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ShoppingCart> builder)
|
||||
{
|
||||
builder.ToTable(nameof(ShoppingCart));
|
||||
|
||||
builder.HasKey(f => f.Id);
|
||||
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd();
|
||||
builder.Property(f => f.UpdatedAt).IsRequired().ValueGeneratedOnAddOrUpdate();
|
||||
builder.Property(f => f.CustomerId).IsRequired(false);
|
||||
builder.Property(f => f.OrderId).IsRequired(false);
|
||||
builder.Property(f => f.QuoteId).IsRequired(false);
|
||||
|
||||
builder.HasOne(f => f.Customer)
|
||||
.WithMany(c => c.ShoppingCarts)
|
||||
.HasForeignKey(f => f.CustomerId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(f => f.Order)
|
||||
.WithOne(o => o.ShoppingCart)
|
||||
.HasForeignKey<Order>(o => o.ShoppingCartId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
builder.HasOne(f => f.Quote)
|
||||
.WithOne(o => o.ShoppingCart)
|
||||
.HasForeignKey<Quote>(o => o.ShoppingCartId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user