Implement Inventory Management Service with CRUD operations for warehouses and inventory items, stock operations, and bulk processing capabilities.
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s
This commit is contained in:
+3942
File diff suppressed because it is too large
Load Diff
+242
@@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddInventorySystem : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Warehouses",
|
||||
schema: "CMS",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
|
||||
Code = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
|
||||
Address = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
|
||||
IsDefault = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
|
||||
IsActive = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Warehouses", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "InventoryItems",
|
||||
schema: "CMS",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ProductId = table.Column<long>(type: "bigint", nullable: true),
|
||||
DiscountProductId = table.Column<long>(type: "bigint", nullable: true),
|
||||
ProductType = table.Column<int>(type: "int", nullable: false),
|
||||
Quantity = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
|
||||
ReservedQuantity = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
|
||||
LowStockThreshold = table.Column<int>(type: "int", nullable: false, defaultValue: 10),
|
||||
ReorderPoint = table.Column<int>(type: "int", nullable: false, defaultValue: 5),
|
||||
MaxStockLevel = table.Column<int>(type: "int", nullable: false, defaultValue: 1000),
|
||||
LastRestockedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastSoldAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
WarehouseId = table.Column<long>(type: "bigint", nullable: false, defaultValue: 1L),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_InventoryItems", x => x.Id);
|
||||
table.CheckConstraint("CK_InventoryItem_ProductReference", "(ProductId IS NOT NULL AND DiscountProductId IS NULL) OR (ProductId IS NULL AND DiscountProductId IS NOT NULL)");
|
||||
table.CheckConstraint("CK_InventoryItem_ProductType_Match", "(ProductType = 1 AND ProductId IS NOT NULL) OR (ProductType = 2 AND DiscountProductId IS NOT NULL)");
|
||||
table.CheckConstraint("CK_InventoryItem_Quantity_NonNegative", "Quantity >= 0");
|
||||
table.CheckConstraint("CK_InventoryItem_ReservedQuantity_LessOrEqualQuantity", "ReservedQuantity <= Quantity");
|
||||
table.CheckConstraint("CK_InventoryItem_ReservedQuantity_NonNegative", "ReservedQuantity >= 0");
|
||||
table.ForeignKey(
|
||||
name: "FK_InventoryItems_DiscountProducts_DiscountProductId",
|
||||
column: x => x.DiscountProductId,
|
||||
principalSchema: "CMS",
|
||||
principalTable: "DiscountProducts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InventoryItems_Products_ProductId",
|
||||
column: x => x.ProductId,
|
||||
principalSchema: "CMS",
|
||||
principalTable: "Products",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_InventoryItems_Warehouses_WarehouseId",
|
||||
column: x => x.WarehouseId,
|
||||
principalSchema: "CMS",
|
||||
principalTable: "Warehouses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StockMovements",
|
||||
schema: "CMS",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
InventoryItemId = table.Column<long>(type: "bigint", nullable: false),
|
||||
MovementType = table.Column<int>(type: "int", nullable: false),
|
||||
Quantity = table.Column<int>(type: "int", nullable: false),
|
||||
QuantityBefore = table.Column<int>(type: "int", nullable: false),
|
||||
QuantityAfter = table.Column<int>(type: "int", nullable: false),
|
||||
OrderId = table.Column<long>(type: "bigint", nullable: true),
|
||||
DiscountOrderId = table.Column<long>(type: "bigint", nullable: true),
|
||||
ReferenceNumber = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
|
||||
Note = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
||||
PerformedByUserId = table.Column<long>(type: "bigint", nullable: true),
|
||||
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
LastModified = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
LastModifiedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_StockMovements", x => x.Id);
|
||||
table.CheckConstraint("CK_StockMovement_QuantityAfter_Calculation", "QuantityAfter = QuantityBefore + Quantity");
|
||||
table.CheckConstraint("CK_StockMovement_QuantityAfter_NonNegative", "QuantityAfter >= 0");
|
||||
table.CheckConstraint("CK_StockMovement_QuantityBefore_NonNegative", "QuantityBefore >= 0");
|
||||
table.ForeignKey(
|
||||
name: "FK_StockMovements_InventoryItems_InventoryItemId",
|
||||
column: x => x.InventoryItemId,
|
||||
principalSchema: "CMS",
|
||||
principalTable: "InventoryItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "CMS",
|
||||
table: "Warehouses",
|
||||
columns: new[] { "Id", "Address", "Code", "Created", "CreatedBy", "IsActive", "IsDefault", "IsDeleted", "LastModified", "LastModifiedBy", "Name" },
|
||||
values: new object[] { 1L, "تهران - انبار مرکزی فروشگاه", "WH-001", new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "System", true, true, false, null, null, "انبار اصلی" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InventoryItems_DiscountProductId",
|
||||
schema: "CMS",
|
||||
table: "InventoryItems",
|
||||
column: "DiscountProductId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InventoryItems_ProductId",
|
||||
schema: "CMS",
|
||||
table: "InventoryItems",
|
||||
column: "ProductId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InventoryItems_ProductType_Quantity",
|
||||
schema: "CMS",
|
||||
table: "InventoryItems",
|
||||
columns: new[] { "ProductType", "Quantity" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_InventoryItems_WarehouseId",
|
||||
schema: "CMS",
|
||||
table: "InventoryItems",
|
||||
column: "WarehouseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StockMovements_Created",
|
||||
schema: "CMS",
|
||||
table: "StockMovements",
|
||||
column: "Created");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StockMovements_DiscountOrderId",
|
||||
schema: "CMS",
|
||||
table: "StockMovements",
|
||||
column: "DiscountOrderId",
|
||||
filter: "[DiscountOrderId] IS NOT NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StockMovements_InventoryItemId",
|
||||
schema: "CMS",
|
||||
table: "StockMovements",
|
||||
column: "InventoryItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StockMovements_Item_Type_Date",
|
||||
schema: "CMS",
|
||||
table: "StockMovements",
|
||||
columns: new[] { "InventoryItemId", "MovementType", "Created" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StockMovements_MovementType",
|
||||
schema: "CMS",
|
||||
table: "StockMovements",
|
||||
column: "MovementType");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StockMovements_OrderId",
|
||||
schema: "CMS",
|
||||
table: "StockMovements",
|
||||
column: "OrderId",
|
||||
filter: "[OrderId] IS NOT NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StockMovements_ReferenceNumber",
|
||||
schema: "CMS",
|
||||
table: "StockMovements",
|
||||
column: "ReferenceNumber",
|
||||
filter: "[ReferenceNumber] IS NOT NULL");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Warehouses_Code_Unique",
|
||||
schema: "CMS",
|
||||
table: "Warehouses",
|
||||
column: "Code",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Warehouses_IsActive",
|
||||
schema: "CMS",
|
||||
table: "Warehouses",
|
||||
column: "IsActive");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Warehouses_IsDefault",
|
||||
schema: "CMS",
|
||||
table: "Warehouses",
|
||||
column: "IsDefault",
|
||||
filter: "[IsDefault] = 1");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "StockMovements",
|
||||
schema: "CMS");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "InventoryItems",
|
||||
schema: "CMS");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Warehouses",
|
||||
schema: "CMS");
|
||||
}
|
||||
}
|
||||
}
|
||||
+310
@@ -1503,6 +1503,102 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("NetworkMembershipHistories", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.InventoryItem", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long?>("DiscountProductId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModifiedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime?>("LastRestockedAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("LastSoldAt")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("LowStockThreshold")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(10);
|
||||
|
||||
b.Property<int>("MaxStockLevel")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(1000);
|
||||
|
||||
b.Property<long?>("ProductId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("ProductType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.Property<int>("ReorderPoint")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(5);
|
||||
|
||||
b.Property<int>("ReservedQuantity")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasDefaultValue(0);
|
||||
|
||||
b.Property<long>("WarehouseId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasDefaultValue(1L);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DiscountProductId")
|
||||
.HasDatabaseName("IX_InventoryItems_DiscountProductId");
|
||||
|
||||
b.HasIndex("ProductId")
|
||||
.HasDatabaseName("IX_InventoryItems_ProductId");
|
||||
|
||||
b.HasIndex("WarehouseId")
|
||||
.HasDatabaseName("IX_InventoryItems_WarehouseId");
|
||||
|
||||
b.HasIndex("ProductType", "Quantity")
|
||||
.HasDatabaseName("IX_InventoryItems_ProductType_Quantity");
|
||||
|
||||
b.ToTable("InventoryItems", "CMS", t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_InventoryItem_ProductReference", "(ProductId IS NOT NULL AND DiscountProductId IS NULL) OR (ProductId IS NULL AND DiscountProductId IS NOT NULL)");
|
||||
|
||||
t.HasCheckConstraint("CK_InventoryItem_ProductType_Match", "(ProductType = 1 AND ProductId IS NOT NULL) OR (ProductType = 2 AND DiscountProductId IS NOT NULL)");
|
||||
|
||||
t.HasCheckConstraint("CK_InventoryItem_Quantity_NonNegative", "Quantity >= 0");
|
||||
|
||||
t.HasCheckConstraint("CK_InventoryItem_ReservedQuantity_LessOrEqualQuantity", "ReservedQuantity <= Quantity");
|
||||
|
||||
t.HasCheckConstraint("CK_InventoryItem_ReservedQuantity_NonNegative", "ReservedQuantity >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Network.NetworkWeeklyBalance", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -2210,6 +2306,97 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("Roles", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.StockMovement", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long?>("DiscountOrderId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InventoryItemId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModifiedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("MovementType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)");
|
||||
|
||||
b.Property<long?>("OrderId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("PerformedByUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("QuantityAfter")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("QuantityBefore")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ReferenceNumber")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("nvarchar(100)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Created")
|
||||
.HasDatabaseName("IX_StockMovements_Created");
|
||||
|
||||
b.HasIndex("DiscountOrderId")
|
||||
.HasDatabaseName("IX_StockMovements_DiscountOrderId")
|
||||
.HasFilter("[DiscountOrderId] IS NOT NULL");
|
||||
|
||||
b.HasIndex("InventoryItemId")
|
||||
.HasDatabaseName("IX_StockMovements_InventoryItemId");
|
||||
|
||||
b.HasIndex("MovementType")
|
||||
.HasDatabaseName("IX_StockMovements_MovementType");
|
||||
|
||||
b.HasIndex("OrderId")
|
||||
.HasDatabaseName("IX_StockMovements_OrderId")
|
||||
.HasFilter("[OrderId] IS NOT NULL");
|
||||
|
||||
b.HasIndex("ReferenceNumber")
|
||||
.HasDatabaseName("IX_StockMovements_ReferenceNumber")
|
||||
.HasFilter("[ReferenceNumber] IS NOT NULL");
|
||||
|
||||
b.HasIndex("InventoryItemId", "MovementType", "Created")
|
||||
.HasDatabaseName("IX_StockMovements_Item_Type_Date");
|
||||
|
||||
b.ToTable("StockMovements", "CMS", t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_StockMovement_QuantityAfter_Calculation", "QuantityAfter = QuantityBefore + Quantity");
|
||||
|
||||
t.HasCheckConstraint("CK_StockMovement_QuantityAfter_NonNegative", "QuantityAfter >= 0");
|
||||
|
||||
t.HasCheckConstraint("CK_StockMovement_QuantityBefore_NonNegative", "QuantityBefore >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Tag", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -2818,6 +3005,83 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.ToTable("UserWalletChangeLogs", "CMS");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Warehouse", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("nvarchar(1000)");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bit")
|
||||
.HasDefaultValue(true);
|
||||
|
||||
b.Property<bool>("IsDefault")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bit")
|
||||
.HasDefaultValue(false);
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("LastModified")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("LastModifiedBy")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("nvarchar(200)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("IX_Warehouses_Code_Unique");
|
||||
|
||||
b.HasIndex("IsActive")
|
||||
.HasDatabaseName("IX_Warehouses_IsActive");
|
||||
|
||||
b.HasIndex("IsDefault")
|
||||
.HasDatabaseName("IX_Warehouses_IsDefault")
|
||||
.HasFilter("[IsDefault] = 1");
|
||||
|
||||
b.ToTable("Warehouses", "CMS");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = 1L,
|
||||
Address = "تهران - انبار مرکزی فروشگاه",
|
||||
Code = "WH-001",
|
||||
Created = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc),
|
||||
CreatedBy = "System",
|
||||
IsActive = true,
|
||||
IsDefault = true,
|
||||
IsDeleted = false,
|
||||
Name = "انبار اصلی"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.WeekDefinition", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
@@ -3185,6 +3449,31 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("WeekDefinition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.InventoryItem", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.DiscountShop.DiscountProduct", "DiscountProduct")
|
||||
.WithMany()
|
||||
.HasForeignKey("DiscountProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.Warehouse", "Warehouse")
|
||||
.WithMany("InventoryItems")
|
||||
.HasForeignKey("WarehouseId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("DiscountProduct");
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
b.Navigation("Warehouse");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Network.NetworkWeeklyBalance", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.User", "User")
|
||||
@@ -3290,6 +3579,17 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("Tag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.StockMovement", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.InventoryItem", "InventoryItem")
|
||||
.WithMany("StockMovements")
|
||||
.HasForeignKey("InventoryItemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("InventoryItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.User", b =>
|
||||
{
|
||||
b.HasOne("CMSMicroservice.Domain.Entities.User", "NetworkParent")
|
||||
@@ -3527,6 +3827,11 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("Cities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.InventoryItem", b =>
|
||||
{
|
||||
b.Navigation("StockMovements");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Package", b =>
|
||||
{
|
||||
b.Navigation("UserOrders");
|
||||
@@ -3611,6 +3916,11 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
|
||||
b.Navigation("UserWalletChangeLogs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Warehouse", b =>
|
||||
{
|
||||
b.Navigation("InventoryItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CMSMicroservice.Domain.Entities.WeekDefinition", b =>
|
||||
{
|
||||
b.Navigation("CommissionPayoutHistories");
|
||||
|
||||
Reference in New Issue
Block a user