Files
components/LiteCharms.Entities/Configuration/OrderRefundConfiguration.cs
T
2026-05-03 16:10:27 +02:00

20 lines
671 B
C#

namespace LiteCharms.Entities.Configuration;
public class OrderRefundConfiguration : IEntityTypeConfiguration<OrderRefund>
{
public void Configure(EntityTypeBuilder<OrderRefund> builder)
{
builder.ToTable(nameof(OrderRefund));
builder.HasKey(f => f.Id);
builder.Property(f => f.CreatedAt).ValueGeneratedOnAdd();
builder.Property(f => f.OrderId).IsRequired();
builder.Property(f => f.Reason).IsRequired();
builder.Property(f => f.Amount).IsRequired().HasPrecision(18, 2);
builder.HasOne(f => f.Order)
.WithOne(o => o.Refund)
.HasForeignKey<OrderRefund>(o => o.OrderId);
}
}