Files
components/LiteCharms.Features.MidrandBooks/Orders/Entities/OrderConfiguration.cs
T
2026-05-26 08:24:38 +02:00

18 lines
719 B
C#

namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
public class OrderConfiguration : IEntityTypeConfiguration<Order>
{
public void Configure(EntityTypeBuilder<Order> builder)
{
builder.ToTable("Orders");
builder.HasKey(o => o.Id);
builder.Property(o => o.CustomerId).IsRequired();
builder.Property(o => o.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
builder.Property(o => o.UpdatedAt).HasDefaultValueSql("now()");
builder.Property(o => o.Status).IsRequired();
builder.Property(o => o.Total).IsRequired().HasColumnType("decimal(18,2)");
builder.Property(o => o.Notes).HasMaxLength(1000);
}
}