Added payment database objects
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Products.Entities;
|
||||
|
||||
[EntityTypeConfiguration<ProductInventoryConfiguration, ProductInventory>]
|
||||
public class ProductInventory : Models.ProductInventory
|
||||
{
|
||||
public virtual Product? Product { get; set; }
|
||||
|
||||
public virtual ProductPrice? Price { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Products.Entities;
|
||||
|
||||
public sealed class ProductInventoryConfiguration : IEntityTypeConfiguration<ProductInventory>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ProductInventory> builder)
|
||||
{
|
||||
builder.ToTable("Inventories");
|
||||
|
||||
builder.HasKey(f => f.Id);
|
||||
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
|
||||
builder.Property(f => f.Status).IsRequired();
|
||||
builder.Property(f => f.TotalAllocated).IsRequired();
|
||||
builder.Property(f => f.TotalReserved).IsRequired();
|
||||
builder.Property(f => f.ProductId).IsRequired();
|
||||
builder.Property(f => f.ProductPriceId).IsRequired();
|
||||
|
||||
builder.HasOne(f => f.Product)
|
||||
.WithMany()
|
||||
.HasForeignKey(f => f.ProductId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
builder.HasOne(f => f.Price)
|
||||
.WithMany()
|
||||
.HasForeignKey(f => f.ProductPriceId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace LiteCharms.Features.MidrandBooks.Products.Models;
|
||||
|
||||
public class ProductInventory
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
public InventoryStatuses Status { get; set; }
|
||||
|
||||
public long ProductId { get; set; }
|
||||
|
||||
public long ProductPriceId { get; set; }
|
||||
|
||||
public int TotalAllocated { get; set; }
|
||||
|
||||
public int TotalReserved { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user