Sealed qualifying public classes Migrated database changes
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
using LiteCharms.Features.MidrandBooks.Payments.Entities;
|
||||
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
|
||||
[EntityTypeConfiguration<OrderConfiguration, Order>]
|
||||
public class Order : Models.Order
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
|
||||
public class OrderConfiguration : IEntityTypeConfiguration<Order>
|
||||
public sealed class OrderConfiguration : IEntityTypeConfiguration<Order>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Order> builder)
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
|
||||
public class OrderItemConfiguration : IEntityTypeConfiguration<OrderItem>
|
||||
public sealed class OrderItemConfiguration : IEntityTypeConfiguration<OrderItem>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<OrderItem> builder)
|
||||
{
|
||||
builder.ToTable("OrderItems");
|
||||
|
||||
builder.HasKey(oi => oi.Id);
|
||||
builder.Property(oi => oi.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("new()");
|
||||
builder.Property(oi => oi.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
|
||||
builder.Property(oi => oi.OrderId).IsRequired();
|
||||
builder.Property(oi => oi.AuthorBookId).IsRequired();
|
||||
builder.Property(oi => oi.ProductPriceId).IsRequired();
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
|
||||
[EntityTypeConfiguration<RefundConfiguration, Refund>]
|
||||
public class Refund : Models.Refund
|
||||
{
|
||||
public virtual Order? Order { get; set; }
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
|
||||
public class RefundConfiguration : IEntityTypeConfiguration<Refund>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Refund> builder)
|
||||
{
|
||||
builder.ToTable("Refunds");
|
||||
|
||||
builder.HasKey(r => r.Id);
|
||||
builder.Property(r => r.OrderId).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(r => r.Amount).IsRequired().HasPrecision(18, 2);
|
||||
builder.Property(r => r.Reason).HasMaxLength(1000);
|
||||
|
||||
builder.HasOne(r => r.Order)
|
||||
.WithMany(o => o.Refunds)
|
||||
.HasForeignKey(r => r.OrderId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
|
||||
public class ShippingConfiguration : IEntityTypeConfiguration<Shipping>
|
||||
public sealed class ShippingConfiguration : IEntityTypeConfiguration<Shipping>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Shipping> builder)
|
||||
{
|
||||
@@ -13,6 +13,7 @@ public class ShippingConfiguration : IEntityTypeConfiguration<Shipping>
|
||||
builder.Property(s => s.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
|
||||
builder.Property(s => s.UpdatedAt).HasDefaultValueSql("now()");
|
||||
builder.Property(s => s.Status).IsRequired();
|
||||
builder.Property(s => s.TrackingNumber).HasMaxLength(255);
|
||||
|
||||
builder.HasOne(s => s.Order)
|
||||
.WithOne(o => o.Shipping)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Orders.Entities;
|
||||
|
||||
public class ShippingProviderConfiguration : IEntityTypeConfiguration<ShippingProvider>
|
||||
public sealed class ShippingProviderConfiguration : IEntityTypeConfiguration<ShippingProvider>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ShippingProvider> builder)
|
||||
{
|
||||
@@ -13,5 +13,6 @@ public class ShippingProviderConfiguration : IEntityTypeConfiguration<ShippingPr
|
||||
builder.Property(f => f.Name).IsRequired().HasMaxLength(100);
|
||||
builder.Property(f => f.Price).IsRequired().HasPrecision(18, 2);
|
||||
builder.Property(f => f.Enabled).HasDefaultValue(true);
|
||||
builder.Property(f => f.TrackingUrl).HasMaxLength(200);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user