2063 lines
70 KiB
C#
2063 lines
70 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using Distribution.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace Distribution.Migrations
|
|
{
|
|
[DbContext(typeof(AppDBContext))]
|
|
[Migration("20260824110925_AddProcurement")]
|
|
partial class AddProcurement
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "9.0.0")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
|
|
|
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("Distribution.Models.Brand", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int?>("ExternalErpId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Brands");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Category", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("AllowCustomerReturn")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int?>("ExternalErpId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Categories");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.DeliveryRun", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime?>("ActivatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<DateTime?>("ClosedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_DriverProfileId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_RouteId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_SourceWarehouseId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_VehicleId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Meterend")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("Meterstart")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("RideType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime?>("StartedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_DriverProfileId");
|
|
|
|
b.HasIndex("FK_RouteId");
|
|
|
|
b.HasIndex("FK_SourceWarehouseId");
|
|
|
|
b.HasIndex("FK_VehicleId");
|
|
|
|
b.ToTable("DeliveryRuns");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.DriverComplianceConfig", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("EnforceLicenseExpiry")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<bool>("EnforceMedicalClearance")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("UpdatedBy")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("DriverComplianceConfigs");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.DriverProfile", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_UserId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime>("LicenseExpiry")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("LicenseNumber")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<DateTime>("MedicalClearanceExpiry")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_UserId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("DriverProfiles");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.GoodsReceipt", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_PurchaseOrderId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ReceivedByUserId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_WarehouseId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime>("ReceivedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_PurchaseOrderId");
|
|
|
|
b.HasIndex("FK_WarehouseId");
|
|
|
|
b.ToTable("GoodsReceipts");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.GoodsReceiptItem", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int>("AcceptedQuantity")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_GoodsReceiptId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_PurchaseOrderItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("RejectedQuantity")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_GoodsReceiptId");
|
|
|
|
b.HasIndex("FK_PurchaseOrderItemId");
|
|
|
|
b.ToTable("GoodsReceiptItems");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Item", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<decimal?>("CostPrice")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Description")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<int?>("ExternalErpItemId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<Guid>("FK_BaseUomId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("FK_BrandId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_CategoryId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("FK_SubCategoryId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime?>("LastSyncedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<decimal?>("SalePrice")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<string>("Sku")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<int>("SyncSource")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_BaseUomId");
|
|
|
|
b.HasIndex("FK_BrandId");
|
|
|
|
b.HasIndex("FK_CategoryId");
|
|
|
|
b.HasIndex("FK_SubCategoryId");
|
|
|
|
b.ToTable("Items");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.LoadingSheet", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<DateTime?>("DispatchConfirmedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid?>("DispatchConfirmedBy")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_RideId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_SourceWarehouseId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime?>("ReceiptConfirmedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid?>("ReceiptConfirmedBy")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_RideId");
|
|
|
|
b.HasIndex("FK_SourceWarehouseId");
|
|
|
|
b.ToTable("LoadingSheets");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.LoadingSheetItem", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_LoadingSheetId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<decimal>("QuantityDispatched")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal?>("QuantityReceived")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal?>("QuantityResolved")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.HasIndex("FK_LoadingSheetId");
|
|
|
|
b.ToTable("LoadingSheetItems");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Order", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_StoreId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime>("OrderDate")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<decimal>("TotalAmount")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_StoreId");
|
|
|
|
b.ToTable("Orders");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.OrderItem", b =>
|
|
{
|
|
b.Property<Guid>("FK_OrderId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Quantity")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("UnitPrice")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("FK_OrderId", "FK_ItemId");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.ToTable("OrderItems");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Permission", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Description")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Permissions");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PriceList", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<DateTime>("EffectiveFrom")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<DateTime>("EffectiveTo")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid?>("FK_RegionId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_RegionId");
|
|
|
|
b.ToTable("PriceLists");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PriceListItem", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_PriceListId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<decimal?>("MinPrice")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal>("Price")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.HasIndex("FK_PriceListId", "FK_ItemId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("PriceListItems");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseOrder", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<string>("CancelReason")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_CreatedByUserId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_SupplierId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_SupplierId");
|
|
|
|
b.ToTable("PurchaseOrders");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseOrderItem", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int>("CancelledQuantity")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_PurchaseOrderId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<bool>("IsCancelled")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Quantity")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("ReceivedQuantity")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("UnitCost")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.HasIndex("FK_PurchaseOrderId");
|
|
|
|
b.ToTable("PurchaseOrderItems");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseReturn", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_PurchaseOrderId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Reason")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_PurchaseOrderId");
|
|
|
|
b.ToTable("PurchaseReturns");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseReturnItem", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_PurchaseReturnId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Quantity")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.HasIndex("FK_PurchaseReturnId");
|
|
|
|
b.ToTable("PurchaseReturnItems");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Region", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Regions");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.RideCancelRequest", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime?>("ApprovedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid?>("ApprovedBy")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_RideId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<string>("Reason")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<DateTime>("RequestedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("RequestedBy")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int>("Status")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("TypeCode")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_RideId");
|
|
|
|
b.ToTable("RideCancelRequests");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Role", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("Level")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Roles");
|
|
|
|
b.HasData(
|
|
new
|
|
{
|
|
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
|
CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
IsActive = true,
|
|
Level = 10,
|
|
Name = "SalesRep"
|
|
},
|
|
new
|
|
{
|
|
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
|
CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
IsActive = true,
|
|
Level = 20,
|
|
Name = "Supervisor"
|
|
},
|
|
new
|
|
{
|
|
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
|
CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
IsActive = true,
|
|
Level = 30,
|
|
Name = "AreaManager"
|
|
},
|
|
new
|
|
{
|
|
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
|
CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
IsActive = true,
|
|
Level = 40,
|
|
Name = "AreaSupervisor"
|
|
},
|
|
new
|
|
{
|
|
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
|
CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
IsActive = true,
|
|
Level = 50,
|
|
Name = "RegionalManager"
|
|
},
|
|
new
|
|
{
|
|
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
|
CreatedAt = new DateTime(2026, 8, 18, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
IsActive = true,
|
|
Level = 60,
|
|
Name = "RegionalAgency"
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.RolePermission", b =>
|
|
{
|
|
b.Property<Guid>("FK_RoleId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_PermissionId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.HasKey("FK_RoleId", "FK_PermissionId");
|
|
|
|
b.HasIndex("FK_PermissionId");
|
|
|
|
b.ToTable("RolePermissions");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Route", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("EndPoint")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<Guid>("FK_RegionId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<decimal>("Length")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<string>("RouteName")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("StartPoint")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_RegionId");
|
|
|
|
b.ToTable("Routes");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.SaleRoute", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("SaleRoutes");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Scheme", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("AgentLimitExempt")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<decimal?>("BaselineExpectedSales")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<DateTime>("DateRangeFrom")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<DateTime>("DateRangeTo")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("EligibleSegment")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<Guid?>("FK_FreeItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("FK_RegionId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("FK_TriggerItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<decimal?>("FreeQty")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<Guid?>("RegionId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<string>("RuleConfig")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<int>("RuleType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int?>("TriggerQty")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_FreeItemId");
|
|
|
|
b.HasIndex("FK_TriggerItemId");
|
|
|
|
b.HasIndex("RegionId");
|
|
|
|
b.ToTable("Schemes");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.SchemeBundleComponent", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_SchemeId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int>("Qty")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.HasIndex("FK_SchemeId", "FK_ItemId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("SchemeBundleComponents");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.SchemeRedemption", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<decimal?>("DiscountAmount")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<Guid?>("FK_FreeItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("FK_OrderId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_SchemeId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("FieldInvoiceId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<decimal?>("FreeItemCostValue")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal?>("FreeQty")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<DateTime>("RedeemedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_FreeItemId");
|
|
|
|
b.HasIndex("FK_OrderId");
|
|
|
|
b.HasIndex("FK_SchemeId");
|
|
|
|
b.ToTable("SchemeRedemptions");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.StockBalance", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("LocationId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int>("LocationType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("Quantity")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<DateTime>("UpdatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ItemId", "LocationId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("StockBalances");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.StockMovement", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("CreatedBy")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("FromLocationId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int?>("FromLocationType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("Quantity")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<string>("ReasonCode")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<Guid?>("ReferenceId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid?>("ToLocationId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<int?>("ToLocationType")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("Type")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.ToTable("StockMovements");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Store", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<decimal>("CreditAmount")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal>("CreditLimit")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<Guid>("FK_RouteId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<int>("KycStatus")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal>("Latitude")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal>("Longitude")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal>("OneTimeAmount")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<decimal>("OutstandingBalance")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.Property<string>("OwnerName")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("Segment")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("StoreAddress")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("StoreName")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_RouteId");
|
|
|
|
b.ToTable("Stores");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.StoreKycDocument", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("DocumentType")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<Guid>("FK_StoreId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<string>("FileReference")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<DateTime>("UploadedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_StoreId");
|
|
|
|
b.ToTable("StoreKycDocuments");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.SubCategory", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int?>("ExternalErpId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<Guid>("FK_CategoryId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_CategoryId");
|
|
|
|
b.ToTable("SubCategories");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Supplier", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<string>("ContactInfo")
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<decimal?>("PerformanceScore")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Suppliers");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Uom", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<int?>("ExternalErpId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("Uoms");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UomConversion", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_FromUomId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ItemId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_ToUomId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<decimal>("Factor")
|
|
.HasColumnType("decimal(65,30)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_FromUomId");
|
|
|
|
b.HasIndex("FK_ItemId");
|
|
|
|
b.HasIndex("FK_ToUomId");
|
|
|
|
b.ToTable("UomConversions");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.User", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid?>("FK_ReportsToUserId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_RoleId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<string>("FullName")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("PasswordHash")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<string>("Username")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FK_ReportsToUserId");
|
|
|
|
b.HasIndex("FK_RoleId");
|
|
|
|
b.ToTable("Users");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UserRegionScope", b =>
|
|
{
|
|
b.Property<Guid>("FK_UserId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_RegionId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.HasKey("FK_UserId", "FK_RegionId");
|
|
|
|
b.HasIndex("FK_RegionId");
|
|
|
|
b.ToTable("UserRegionScopes");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UserRouteScope", b =>
|
|
{
|
|
b.Property<Guid>("FK_UserId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_RouteId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.HasKey("FK_UserId", "FK_RouteId");
|
|
|
|
b.HasIndex("FK_RouteId");
|
|
|
|
b.ToTable("UserRouteScopes");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UserStoreScope", b =>
|
|
{
|
|
b.Property<Guid>("FK_UserId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<Guid>("FK_StoreId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid>("Id")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.HasKey("FK_UserId", "FK_StoreId");
|
|
|
|
b.HasIndex("FK_StoreId");
|
|
|
|
b.ToTable("UserStoreScopes");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Vehicle", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<Guid?>("DefaultWarehouseId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("NumberPlate")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("RegNumber")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<int>("Type")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DefaultWarehouseId");
|
|
|
|
b.ToTable("Vehicles");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Warehouse", b =>
|
|
{
|
|
b.Property<Guid>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("char(36)");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("datetime(6)");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.HasColumnType("tinyint(1)");
|
|
|
|
b.Property<string>("Location")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasColumnType("longtext");
|
|
|
|
b.Property<int>("Type")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<Guid?>("VehicleId")
|
|
.HasColumnType("char(36)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("VehicleId");
|
|
|
|
b.ToTable("Warehouses");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.DeliveryRun", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.DriverProfile", "DriverProfile")
|
|
.WithMany()
|
|
.HasForeignKey("FK_DriverProfileId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Route", "Route")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RouteId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Warehouse", "SourceWarehouse")
|
|
.WithMany()
|
|
.HasForeignKey("FK_SourceWarehouseId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Vehicle", "Vehicle")
|
|
.WithMany()
|
|
.HasForeignKey("FK_VehicleId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("DriverProfile");
|
|
|
|
b.Navigation("Route");
|
|
|
|
b.Navigation("SourceWarehouse");
|
|
|
|
b.Navigation("Vehicle");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.DriverProfile", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("FK_UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.GoodsReceipt", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.PurchaseOrder", "PurchaseOrder")
|
|
.WithMany()
|
|
.HasForeignKey("FK_PurchaseOrderId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Warehouse", "Warehouse")
|
|
.WithMany()
|
|
.HasForeignKey("FK_WarehouseId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("PurchaseOrder");
|
|
|
|
b.Navigation("Warehouse");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.GoodsReceiptItem", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.GoodsReceipt", "GoodsReceipt")
|
|
.WithMany("Items")
|
|
.HasForeignKey("FK_GoodsReceiptId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.PurchaseOrderItem", "PurchaseOrderItem")
|
|
.WithMany()
|
|
.HasForeignKey("FK_PurchaseOrderItemId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("GoodsReceipt");
|
|
|
|
b.Navigation("PurchaseOrderItem");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Item", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Uom", "BaseUom")
|
|
.WithMany()
|
|
.HasForeignKey("FK_BaseUomId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Brand", "Brand")
|
|
.WithMany()
|
|
.HasForeignKey("FK_BrandId");
|
|
|
|
b.HasOne("Distribution.Models.Category", "Category")
|
|
.WithMany()
|
|
.HasForeignKey("FK_CategoryId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.SubCategory", "SubCategory")
|
|
.WithMany()
|
|
.HasForeignKey("FK_SubCategoryId");
|
|
|
|
b.Navigation("BaseUom");
|
|
|
|
b.Navigation("Brand");
|
|
|
|
b.Navigation("Category");
|
|
|
|
b.Navigation("SubCategory");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.LoadingSheet", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.DeliveryRun", "Ride")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RideId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Warehouse", "SourceWarehouse")
|
|
.WithMany()
|
|
.HasForeignKey("FK_SourceWarehouseId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Ride");
|
|
|
|
b.Navigation("SourceWarehouse");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.LoadingSheetItem", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.LoadingSheet", "LoadingSheet")
|
|
.WithMany("Items")
|
|
.HasForeignKey("FK_LoadingSheetId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
|
|
b.Navigation("LoadingSheet");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Order", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Store", "Store")
|
|
.WithMany()
|
|
.HasForeignKey("FK_StoreId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Store");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.OrderItem", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Order", "Order")
|
|
.WithMany()
|
|
.HasForeignKey("FK_OrderId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
|
|
b.Navigation("Order");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PriceList", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Region", "Region")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RegionId");
|
|
|
|
b.Navigation("Region");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PriceListItem", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.PriceList", "PriceList")
|
|
.WithMany("Items")
|
|
.HasForeignKey("FK_PriceListId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
|
|
b.Navigation("PriceList");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseOrder", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Supplier", "Supplier")
|
|
.WithMany()
|
|
.HasForeignKey("FK_SupplierId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Supplier");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseOrderItem", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.PurchaseOrder", "PurchaseOrder")
|
|
.WithMany("Items")
|
|
.HasForeignKey("FK_PurchaseOrderId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
|
|
b.Navigation("PurchaseOrder");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseReturn", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.PurchaseOrder", "PurchaseOrder")
|
|
.WithMany()
|
|
.HasForeignKey("FK_PurchaseOrderId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("PurchaseOrder");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseReturnItem", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.PurchaseReturn", "PurchaseReturn")
|
|
.WithMany("Items")
|
|
.HasForeignKey("FK_PurchaseReturnId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
|
|
b.Navigation("PurchaseReturn");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.RideCancelRequest", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.DeliveryRun", "Ride")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RideId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Ride");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.RolePermission", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Permission", "Permission")
|
|
.WithMany()
|
|
.HasForeignKey("FK_PermissionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Role", "Role")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RoleId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Permission");
|
|
|
|
b.Navigation("Role");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Route", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Region", "Region")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RegionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Region");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Scheme", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "FreeItem")
|
|
.WithMany()
|
|
.HasForeignKey("FK_FreeItemId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("Distribution.Models.Item", "TriggerItem")
|
|
.WithMany()
|
|
.HasForeignKey("FK_TriggerItemId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("Distribution.Models.Region", "Region")
|
|
.WithMany()
|
|
.HasForeignKey("RegionId");
|
|
|
|
b.Navigation("FreeItem");
|
|
|
|
b.Navigation("Region");
|
|
|
|
b.Navigation("TriggerItem");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.SchemeBundleComponent", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Scheme", "Scheme")
|
|
.WithMany("BundleComponents")
|
|
.HasForeignKey("FK_SchemeId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
|
|
b.Navigation("Scheme");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.SchemeRedemption", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "FreeItem")
|
|
.WithMany()
|
|
.HasForeignKey("FK_FreeItemId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("Distribution.Models.Order", "Order")
|
|
.WithMany()
|
|
.HasForeignKey("FK_OrderId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("Distribution.Models.Scheme", "Scheme")
|
|
.WithMany("Redemptions")
|
|
.HasForeignKey("FK_SchemeId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("FreeItem");
|
|
|
|
b.Navigation("Order");
|
|
|
|
b.Navigation("Scheme");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.StockBalance", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.StockMovement", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Item");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Store", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Route", "Route")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RouteId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Route");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.StoreKycDocument", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Store", "Store")
|
|
.WithMany()
|
|
.HasForeignKey("FK_StoreId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Store");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.SubCategory", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Category", "Category")
|
|
.WithMany()
|
|
.HasForeignKey("FK_CategoryId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Category");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UomConversion", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Uom", "FromUom")
|
|
.WithMany()
|
|
.HasForeignKey("FK_FromUomId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Item", "Item")
|
|
.WithMany("Conversions")
|
|
.HasForeignKey("FK_ItemId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.Uom", "ToUom")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ToUomId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("FromUom");
|
|
|
|
b.Navigation("Item");
|
|
|
|
b.Navigation("ToUom");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.User", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.User", "ReportsTo")
|
|
.WithMany()
|
|
.HasForeignKey("FK_ReportsToUserId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("Distribution.Models.Role", "Role")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RoleId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("ReportsTo");
|
|
|
|
b.Navigation("Role");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UserRegionScope", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Region", "Region")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RegionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("FK_UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Region");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UserRouteScope", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Route", "Route")
|
|
.WithMany()
|
|
.HasForeignKey("FK_RouteId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("FK_UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Route");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.UserStoreScope", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Store", "Store")
|
|
.WithMany()
|
|
.HasForeignKey("FK_StoreId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("Distribution.Models.User", "User")
|
|
.WithMany()
|
|
.HasForeignKey("FK_UserId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Store");
|
|
|
|
b.Navigation("User");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Vehicle", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Warehouse", null)
|
|
.WithMany()
|
|
.HasForeignKey("DefaultWarehouseId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Warehouse", b =>
|
|
{
|
|
b.HasOne("Distribution.Models.Vehicle", "Vehicle")
|
|
.WithMany()
|
|
.HasForeignKey("VehicleId");
|
|
|
|
b.Navigation("Vehicle");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.GoodsReceipt", b =>
|
|
{
|
|
b.Navigation("Items");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Item", b =>
|
|
{
|
|
b.Navigation("Conversions");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.LoadingSheet", b =>
|
|
{
|
|
b.Navigation("Items");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PriceList", b =>
|
|
{
|
|
b.Navigation("Items");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseOrder", b =>
|
|
{
|
|
b.Navigation("Items");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.PurchaseReturn", b =>
|
|
{
|
|
b.Navigation("Items");
|
|
});
|
|
|
|
modelBuilder.Entity("Distribution.Models.Scheme", b =>
|
|
{
|
|
b.Navigation("BundleComponents");
|
|
|
|
b.Navigation("Redemptions");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|