20 lines
671 B
C#
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);
|
|
}
|
|
}
|