diff --git a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.Designer.cs b/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.Designer.cs deleted file mode 100644 index a4f063f..0000000 --- a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.Designer.cs +++ /dev/null @@ -1,8799 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260929131905_AddSalesConfig")] - partial class AddSalesConfig - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.cs b/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.cs deleted file mode 100644 index bc03c6f..0000000 --- a/Backend/ERPCore/Migrations/20260929131905_AddSalesConfig.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfig : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "sales_config", - columns: table => new - { - ConfigId = table.Column(type: "integer", nullable: false), - AllowCashCustomer = table.Column(type: "boolean", nullable: false, defaultValue: false), - CashCustomerId = table.Column(type: "integer", nullable: true), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - UpdatedBy = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_sales_config", x => x.ConfigId); - table.CheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - table.ForeignKey( - name: "FK_sales_config_customers_CashCustomerId", - column: x => x.CashCustomerId, - principalTable: "customers", - principalColumn: "CustomerId", - onDelete: ReferentialAction.SetNull); - table.ForeignKey( - name: "FK_sales_config_users_UpdatedBy", - column: x => x.UpdatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_sales_config_CashCustomerId", - table: "sales_config", - column: "CashCustomerId"); - - migrationBuilder.CreateIndex( - name: "IX_sales_config_UpdatedBy", - table: "sales_config", - column: "UpdatedBy"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.Designer.cs b/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.Designer.cs deleted file mode 100644 index 406388b..0000000 --- a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.Designer.cs +++ /dev/null @@ -1,8804 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930043658_AddSalesConfigAllowFreeItems")] - partial class AddSalesConfigAllowFreeItems - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.cs b/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.cs deleted file mode 100644 index c43b73c..0000000 --- a/Backend/ERPCore/Migrations/20260930043658_AddSalesConfigAllowFreeItems.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigAllowFreeItems : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowFreeItems", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowFreeItems", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.Designer.cs b/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.Designer.cs deleted file mode 100644 index 5c14dc3..0000000 --- a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.Designer.cs +++ /dev/null @@ -1,8809 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930044903_AddSalesConfigAllowOverStockSale")] - partial class AddSalesConfigAllowOverStockSale - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.cs b/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.cs deleted file mode 100644 index e8ee109..0000000 --- a/Backend/ERPCore/Migrations/20260930044903_AddSalesConfigAllowOverStockSale.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigAllowOverStockSale : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowOverStockSale", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowOverStockSale", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.Designer.cs b/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.Designer.cs deleted file mode 100644 index 6caa4a2..0000000 --- a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.Designer.cs +++ /dev/null @@ -1,8826 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930050220_AddSalesConfigWarehouseSelection")] - partial class AddSalesConfigWarehouseSelection - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.cs b/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.cs deleted file mode 100644 index 680f6dc..0000000 --- a/Backend/ERPCore/Migrations/20260930050220_AddSalesConfigWarehouseSelection.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigWarehouseSelection : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowWarehouseSelection", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: true); - - migrationBuilder.AddColumn( - name: "DefaultWarehouseId", - table: "sales_config", - type: "integer", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_sales_config_DefaultWarehouseId", - table: "sales_config", - column: "DefaultWarehouseId"); - - migrationBuilder.AddForeignKey( - name: "FK_sales_config_warehouses_DefaultWarehouseId", - table: "sales_config", - column: "DefaultWarehouseId", - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.SetNull); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_sales_config_warehouses_DefaultWarehouseId", - table: "sales_config"); - - migrationBuilder.DropIndex( - name: "IX_sales_config_DefaultWarehouseId", - table: "sales_config"); - - migrationBuilder.DropColumn( - name: "AllowWarehouseSelection", - table: "sales_config"); - - migrationBuilder.DropColumn( - name: "DefaultWarehouseId", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.Designer.cs b/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.Designer.cs deleted file mode 100644 index 9598c11..0000000 --- a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.Designer.cs +++ /dev/null @@ -1,8831 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930062500_AddProductConfigCustomVariants")] - partial class AddProductConfigCustomVariants - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.cs b/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.cs deleted file mode 100644 index 69225e0..0000000 --- a/Backend/ERPCore/Migrations/20260930062500_AddProductConfigCustomVariants.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddProductConfigCustomVariants : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CustomVariantsEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CustomVariantsEnabled", - table: "product_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.Designer.cs b/Backend/ERPCore/Migrations/20260930063644_AddItemImages.Designer.cs deleted file mode 100644 index 4fa77e2..0000000 --- a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.Designer.cs +++ /dev/null @@ -1,8897 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930063644_AddItemImages")] - partial class AddItemImages - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.cs b/Backend/ERPCore/Migrations/20260930063644_AddItemImages.cs deleted file mode 100644 index 48b0259..0000000 --- a/Backend/ERPCore/Migrations/20260930063644_AddItemImages.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddItemImages : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ItemImagesEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.CreateTable( - name: "item_images", - columns: table => new - { - ItemImageId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - ItemId = table.Column(type: "integer", nullable: false), - OriginalFileName = table.Column(type: "character varying(260)", maxLength: 260, nullable: false), - StoredFileName = table.Column(type: "character varying(260)", maxLength: 260, nullable: false), - RelativePath = table.Column(type: "character varying(500)", maxLength: 500, nullable: false), - ContentType = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - SizeBytes = table.Column(type: "bigint", nullable: false), - SortOrder = table.Column(type: "integer", nullable: false), - UploadedBy = table.Column(type: "integer", nullable: false), - UploadedAt = table.Column(type: "timestamp with time zone", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_item_images", x => x.ItemImageId); - table.ForeignKey( - name: "FK_item_images_items_ItemId", - column: x => x.ItemId, - principalTable: "items", - principalColumn: "ItemId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_item_images_ItemId_SortOrder", - table: "item_images", - columns: new[] { "ItemId", "SortOrder" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "item_images"); - - migrationBuilder.DropColumn( - name: "ItemImagesEnabled", - table: "product_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.Designer.cs b/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.Designer.cs deleted file mode 100644 index 2c4d679..0000000 --- a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.Designer.cs +++ /dev/null @@ -1,8909 +0,0 @@ -// -using System; -using System.Collections.Generic; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930065738_AddCustomWarrantyPeriods")] - partial class AddCustomWarrantyPeriods - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.PrimitiveCollection>("CustomWarrantyPeriodMonths") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("integer[]") - .HasDefaultValueSql("'{}'::integer[]"); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.cs b/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.cs deleted file mode 100644 index eea1553..0000000 --- a/Backend/ERPCore/Migrations/20260930065738_AddCustomWarrantyPeriods.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddCustomWarrantyPeriods : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "CustomWarrantyPeriodMonths", - table: "product_config", - type: "integer[]", - nullable: false, - defaultValueSql: "'{}'::integer[]"); - - migrationBuilder.AddColumn( - name: "CustomWarrantyPeriodsEnabled", - table: "product_config", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CustomWarrantyPeriodMonths", - table: "product_config"); - - migrationBuilder.DropColumn( - name: "CustomWarrantyPeriodsEnabled", - table: "product_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.Designer.cs b/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.Designer.cs deleted file mode 100644 index a72a6f2..0000000 --- a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.Designer.cs +++ /dev/null @@ -1,8939 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930071621_MoveCustomWarrantyPeriodsToMaster")] - partial class MoveCustomWarrantyPeriodsToMaster - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.cs b/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.cs deleted file mode 100644 index 912e706..0000000 --- a/Backend/ERPCore/Migrations/20260930071621_MoveCustomWarrantyPeriodsToMaster.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class MoveCustomWarrantyPeriodsToMaster : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "warranty_periods", - columns: table => new - { - WarrantyPeriodId = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Months = table.Column(type: "integer", nullable: false), - Status = table.Column(type: "character varying(20)", maxLength: 20, nullable: false, defaultValue: "Active"), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_warranty_periods", x => x.WarrantyPeriodId); - table.CheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - - migrationBuilder.CreateIndex( - name: "IX_warranty_periods_Months", - table: "warranty_periods", - column: "Months", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_warranty_periods_Status", - table: "warranty_periods", - column: "Status"); - - // Carry over any periods already saved on the config (hand-added — EF would have - // dropped the column first and lost them). Out-of-range values are skipped rather - // than failing the check constraint. - migrationBuilder.Sql(""" - INSERT INTO warranty_periods ("Months", "Status", "CreatedAt") - SELECT DISTINCT m, 'Active', now() - FROM product_config, unnest("CustomWarrantyPeriodMonths") AS m - WHERE m BETWEEN 1 AND 600 - ON CONFLICT ("Months") DO NOTHING; - """); - - migrationBuilder.DropColumn( - name: "CustomWarrantyPeriodMonths", - table: "product_config"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn>( - name: "CustomWarrantyPeriodMonths", - table: "product_config", - type: "integer[]", - nullable: false, - defaultValueSql: "'{}'::integer[]"); - - migrationBuilder.Sql(""" - UPDATE product_config SET "CustomWarrantyPeriodMonths" = COALESCE( - (SELECT array_agg("Months" ORDER BY "Months") FROM warranty_periods WHERE "Status" = 'Active'), - '{}'::integer[]); - """); - - migrationBuilder.DropTable( - name: "warranty_periods"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.Designer.cs b/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.Designer.cs deleted file mode 100644 index e5ea9fe..0000000 --- a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.Designer.cs +++ /dev/null @@ -1,8944 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20260930094023_AddSalesConfigAllowDiscounts")] - partial class AddSalesConfigAllowDiscounts - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.cs b/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.cs deleted file mode 100644 index 474f4de..0000000 --- a/Backend/ERPCore/Migrations/20260930094023_AddSalesConfigAllowDiscounts.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddSalesConfigAllowDiscounts : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowDiscounts", - table: "sales_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowDiscounts", - table: "sales_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.Designer.cs b/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.Designer.cs deleted file mode 100644 index 5257e4e..0000000 --- a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.Designer.cs +++ /dev/null @@ -1,8998 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20261002061913_AddGrnConfig")] - partial class AddGrnConfig - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("grn_config", null, t => - { - t.HasCheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.cs b/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.cs deleted file mode 100644 index 695addd..0000000 --- a/Backend/ERPCore/Migrations/20261002061913_AddGrnConfig.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddGrnConfig : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "grn_config", - columns: table => new - { - ConfigId = table.Column(type: "integer", nullable: false), - AllowWarehouseSelection = table.Column(type: "boolean", nullable: false, defaultValue: true), - DefaultWarehouseId = table.Column(type: "integer", nullable: true), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - UpdatedBy = table.Column(type: "integer", nullable: true), - xmin = table.Column(type: "xid", rowVersion: true, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_grn_config", x => x.ConfigId); - table.CheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); - table.ForeignKey( - name: "FK_grn_config_users_UpdatedBy", - column: x => x.UpdatedBy, - principalTable: "users", - principalColumn: "UserId", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_grn_config_warehouses_DefaultWarehouseId", - column: x => x.DefaultWarehouseId, - principalTable: "warehouses", - principalColumn: "WarehouseId", - onDelete: ReferentialAction.SetNull); - }); - - migrationBuilder.CreateIndex( - name: "IX_grn_config_DefaultWarehouseId", - table: "grn_config", - column: "DefaultWarehouseId"); - - migrationBuilder.CreateIndex( - name: "IX_grn_config_UpdatedBy", - table: "grn_config", - column: "UpdatedBy"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "grn_config"); - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.Designer.cs b/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.Designer.cs deleted file mode 100644 index 1fa8ae5..0000000 --- a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.Designer.cs +++ /dev/null @@ -1,9008 +0,0 @@ -// -using System; -using ERPCore.Infra.Persistence; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace ERPCore.Migrations -{ - [DbContext(typeof(ErpDbContext))] - [Migration("20261002064142_AddGrnConfigDiscountsVat")] - partial class AddGrnConfigDiscountsVat - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.Property("AttendanceRecordId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceRecordId")); - - b.Property("AttendanceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("AttendanceStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("AttendanceUploadBatchId") - .HasColumnType("integer"); - - b.Property("CheckIn") - .HasColumnType("interval"); - - b.Property("CheckOut") - .HasColumnType("interval"); - - b.Property("DuplicateOfAttendanceRecordId") - .HasColumnType("integer"); - - b.Property("EarlyLeaveMinutes") - .HasColumnType("integer"); - - b.Property("EditedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EditedBy") - .HasColumnType("integer"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsManualOverride") - .HasColumnType("boolean"); - - b.Property("LateMinutes") - .HasColumnType("integer"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OvertimeMinutes") - .HasColumnType("integer"); - - b.Property("RowValidationStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.Property("WorkingMinutes") - .HasColumnType("integer"); - - b.HasKey("AttendanceRecordId"); - - b.HasIndex("AttendanceUploadBatchId"); - - b.HasIndex("WorkShiftId"); - - b.HasIndex("EmployeeId", "AttendanceDate"); - - b.ToTable("hr_attendance_records", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceUploadBatch", b => - { - b.Property("AttendanceUploadBatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AttendanceUploadBatchId")); - - b.Property("ConfirmedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ConfirmedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OriginalFileName") - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("PeriodEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("PeriodStart") - .HasColumnType("timestamp with time zone"); - - b.Property("RowCountDuplicate") - .HasColumnType("integer"); - - b.Property("RowCountError") - .HasColumnType("integer"); - - b.Property("RowCountTotal") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SourceType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("AttendanceUploadBatchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodStart", "PeriodEnd"); - - b.ToTable("hr_attendance_upload_batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.Property("AuditId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuditId")); - - b.Property("Action") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("ChangeSet") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EntityId") - .HasColumnType("integer"); - - b.Property("EntityType") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("AuditId"); - - b.HasIndex("CreatedAt"); - - b.HasIndex("UserId"); - - b.HasIndex("EntityType", "EntityId"); - - b.ToTable("audit_logs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.Property("BatchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BatchId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BatchNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("ExpiryDate") - .HasColumnType("date"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.HasKey("BatchId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "BatchNo") - .IsUnique(); - - b.ToTable("batches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.Property("BinId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BinId")); - - b.Property("BinType") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BinId"); - - b.HasIndex("WarehouseId", "Code") - .IsUnique(); - - b.ToTable("bins", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Branch", b => - { - b.Property("BranchId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BranchId")); - - b.Property("Address") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PhoneNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_branches", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BranchingEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarehouseBranchingEnabled") - .HasColumnType("boolean"); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("branch_config", null, t => - { - t.HasCheckConstraint("ck_branch_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Brand", b => - { - b.Property("BrandId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BrandId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BrandId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("brands", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Property("BundleSaleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleId")); - - b.Property("BundleCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundleDate") - .HasColumnType("timestamp with time zone"); - - b.Property("BundleName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BundleNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BundlePrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ComponentSubtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("MarginAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleId"); - - b.HasIndex("BundleNo") - .IsUnique(); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sales", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.Property("BundleSaleLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleLineId")); - - b.Property("BundleSaleId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IncludeInBundle") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("IsComponent") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleLineId"); - - b.HasIndex("BundleSaleId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Property("BundleSaleTemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateId")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TemplateCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("TemplateName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("BundleSaleTemplateId"); - - b.HasIndex("TemplateCode") - .IsUnique(); - - b.ToTable("bundle_sale_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.Property("BundleSaleTemplateLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("BundleSaleTemplateLineId")); - - b.Property("BundleSaleTemplateId") - .HasColumnType("integer"); - - b.Property("IncludeInBundle") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("BundleSaleTemplateLineId"); - - b.HasIndex("BundleSaleTemplateId"); - - b.HasIndex("ItemId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("bundle_sale_template_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Property("CategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CategoryId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("categories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.Property("CustomerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CustomerId")); - - b.Property("AddressLine1") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("AddressLine2") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreditDays") - .HasColumnType("integer"); - - b.Property("CreditLimit") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CustomerCode") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CustomerType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("DisplayName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxRegistrationNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CustomerId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CustomerCode") - .IsUnique(); - - b.HasIndex("CustomerType"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("customers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DepartmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("HeadEmployeeId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ParentDepartmentId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DepartmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("HeadEmployeeId"); - - b.HasIndex("ParentDepartmentId"); - - b.HasIndex("Status"); - - b.ToTable("hr_departments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Designation", b => - { - b.Property("DesignationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("DesignationId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("DesignationId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_designations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.Property("EmployeeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeId")); - - b.Property("AddressLine1") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("City") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ConfirmationDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Country") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DateOfBirth") - .HasColumnType("timestamp with time zone"); - - b.Property("DepartmentId") - .HasColumnType("integer"); - - b.Property("DesignationId") - .HasColumnType("integer"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("EmergencyContactName") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmergencyContactPhone") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmergencyContactRelationship") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("EmployeeCode") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmploymentTypeId") - .HasColumnType("integer"); - - b.Property("EpfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EtfNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Gender") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("HireDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LastWorkingDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Nationality") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Nic") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PersonalMobile") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PostalCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ProfilePhotoPath") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("ReportingManagerId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxIdentificationNumber") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("WorkShiftId") - .HasColumnType("integer"); - - b.HasKey("EmployeeId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("DesignationId"); - - b.HasIndex("Email"); - - b.HasIndex("EmployeeCode") - .IsUnique(); - - b.HasIndex("EmploymentTypeId"); - - b.HasIndex("ReportingManagerId"); - - b.HasIndex("Status"); - - b.HasIndex("UserId") - .IsUnique(); - - b.HasIndex("WorkShiftId"); - - b.ToTable("hr_employees", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.Property("EmployeeBankDetailId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeBankDetailId")); - - b.Property("AccountHolderName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("AccountNumber") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("BankName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("BranchName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("SwiftCode") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmployeeBankDetailId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("hr_employee_bank_details", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.Property("EmployeeDocumentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeDocumentId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("ExpiryDate") - .HasColumnType("timestamp with time zone"); - - b.Property("HrDocumentTypeId") - .HasColumnType("integer"); - - b.Property("IssueDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.Property("VerifiedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VerifiedBy") - .HasColumnType("integer"); - - b.HasKey("EmployeeDocumentId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ExpiryDate"); - - b.HasIndex("HrDocumentTypeId"); - - b.ToTable("hr_employee_documents", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Property("EmployeeLoanId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeLoanId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("InstallmentAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("InterestRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("LoanKind") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("NumberOfInstallments") - .HasColumnType("integer"); - - b.Property("OutstandingBalance") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PrincipalAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartMonth") - .HasColumnType("integer"); - - b.Property("StartYear") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeLoanId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("Status"); - - b.ToTable("hr_employee_loans", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Property("EmployeeSalaryStructureId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Currency") - .IsRequired() - .HasMaxLength(3) - .HasColumnType("character varying(3)"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("EmployeeSalaryStructureId"); - - b.HasIndex("EmployeeId", "EffectiveTo"); - - b.ToTable("hr_employee_salary_structures", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.Property("EmployeeSalaryStructureLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmployeeSalaryStructureLineId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeSalaryStructureId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.HasKey("EmployeeSalaryStructureLineId"); - - b.HasIndex("EmployeeSalaryStructureId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_employee_salary_structure_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmploymentType", b => - { - b.Property("EmploymentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EmploymentTypeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("EmploymentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_employment_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Property("GrnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("PostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("GrnId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("PoId"); - - b.HasIndex("PurchaseInvoiceId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("grns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowVat") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("grn_config", null, t => - { - t.HasCheckConstraint("ck_grn_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Property("GrnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("HoldStatus") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("PoLineId") - .HasColumnType("integer"); - - b.Property("PoUnitPrice") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceivedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("VatAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.HasKey("GrnLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("GrnId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoLineId"); - - b.ToTable("grn_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.Property("GrnLineWarrantyNumberId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("GrnLineWarrantyNumberId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("WarrantyNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("GrnLineWarrantyNumberId"); - - b.HasIndex("GrnLineId", "WarrantyNo") - .IsUnique(); - - b.ToTable("grn_line_warranty_numbers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.HrDocumentType", b => - { - b.Property("HrDocumentTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("HrDocumentTypeId")); - - b.Property("Category") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ExpiryTracked") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiredAtOnboarding") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("HrDocumentTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_document_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Property("ItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("BaseUomId") - .HasColumnType("integer"); - - b.Property("BrandId") - .HasColumnType("integer"); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("ContentBaseQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentBaseUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ContentQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ContentUnit") - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DefaultVendorId") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingFlatPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMaxPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SellingMinPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("StockNature") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SubCategoryId") - .HasColumnType("integer"); - - b.Property("TaxRateId") - .HasColumnType("integer"); - - b.Property("TrackingMode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Warranty") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("NonWarranty"); - - b.Property("WarrantyPeriodMonths") - .HasColumnType("integer"); - - b.HasKey("ItemId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("BaseUomId"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.HasIndex("DefaultVendorId"); - - b.HasIndex("Sku") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("SubCategoryId"); - - b.HasIndex("TaxRateId"); - - b.ToTable("items", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.Property("ItemImageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemImageId")); - - b.Property("ContentType") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("OriginalFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("RelativePath") - .IsRequired() - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("SizeBytes") - .HasColumnType("bigint"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("StoredFileName") - .IsRequired() - .HasMaxLength(260) - .HasColumnType("character varying(260)"); - - b.Property("UploadedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UploadedBy") - .HasColumnType("integer"); - - b.HasKey("ItemImageId"); - - b.HasIndex("ItemId", "SortOrder"); - - b.ToTable("item_images", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.Property("ReorderId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReorderId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("ReorderPoint") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReorderQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReorderId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId") - .IsUnique(); - - b.ToTable("item_reorders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemType", b => - { - b.Property("ItemTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ItemTypeId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsMeasurable") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("ItemTypeId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("item_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.JournalEntryStub", b => - { - b.Property("JournalId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("JournalId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CreditAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("DebitAccount") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("JournalId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.ToTable("journal_entry_stubs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.Property("LeaveBalanceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveBalanceId")); - - b.Property("AdjustmentDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarriedForwardDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EntitledDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TakenDays") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Year") - .HasColumnType("integer"); - - b.HasKey("LeaveBalanceId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("EmployeeId", "LeaveTypeId", "Year") - .IsUnique(); - - b.ToTable("hr_leave_balances", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.Property("LeaveRequestId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveRequestId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DaysCount") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EndDate") - .HasColumnType("timestamp with time zone"); - - b.Property("LeaveTypeId") - .HasColumnType("integer"); - - b.Property("Reason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RejectionReason") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StartDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LeaveRequestId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LeaveTypeId"); - - b.HasIndex("Status"); - - b.HasIndex("StartDate", "EndDate"); - - b.ToTable("hr_leave_requests", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveType", b => - { - b.Property("LeaveTypeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaveTypeId")); - - b.Property("AccrualPerYear") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("CarryForwardAllowed") - .HasColumnType("boolean"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CountsAsNoPay") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsPaid") - .HasColumnType("boolean"); - - b.Property("MaxCarryForwardDays") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RequiresApproval") - .HasColumnType("boolean"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("LeaveTypeId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_leave_types", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.Property("LoanInstallmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoanInstallmentId")); - - b.Property("DueMonth") - .HasColumnType("integer"); - - b.Property("DueYear") - .HasColumnType("integer"); - - b.Property("EmployeeLoanId") - .HasColumnType("integer"); - - b.Property("InstallmentNumber") - .HasColumnType("integer"); - - b.Property("PaidAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScheduledAmount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("LoanInstallmentId"); - - b.HasIndex("EmployeeLoanId"); - - b.HasIndex("PayrollRunId"); - - b.HasIndex("DueYear", "DueMonth"); - - b.ToTable("hr_loan_installments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.Property("LoginActivityId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginActivityId")); - - b.Property("DeviceLabel") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IpAddress") - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b.Property("LoginAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserAgent") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("LoginActivityId"); - - b.HasIndex("UserId", "LoginAt"); - - b.ToTable("login_activities", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Property("NavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("NavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("nav_items", (string)null); - - b.HasData( - new - { - NavItemId = 1, - Code = "dashboard", - Href = "/dashboard", - Label = "Dashboard", - SortOrder = 1, - Status = "Active" - }, - new - { - NavItemId = 2, - Code = "products", - Href = "/dashboard/products", - Label = "Products", - SortOrder = 2, - Status = "Active" - }, - new - { - NavItemId = 4, - Code = "procurement", - Href = "/dashboard/procurement", - Label = "Procurement", - SortOrder = 4, - Status = "Active" - }, - new - { - NavItemId = 5, - Code = "receiving", - Href = "/dashboard/receiving/grn", - Label = "Receiving", - SortOrder = 5, - Status = "Active" - }, - new - { - NavItemId = 6, - Code = "stock", - Href = "/dashboard/stock", - Label = "Stock", - SortOrder = 6, - Status = "Active" - }, - new - { - NavItemId = 7, - Code = "warehouses", - Href = "/dashboard/warehouse", - Label = "Warehouses", - SortOrder = 7, - Status = "Active" - }, - new - { - NavItemId = 8, - Code = "orders", - Href = "/dashboard/orders", - Label = "Orders", - SortOrder = 8, - Status = "Active" - }, - new - { - NavItemId = 9, - Code = "settings", - Href = "/dashboard/settings", - Label = "Settings", - SortOrder = 9, - Status = "Active" - }, - new - { - NavItemId = 10, - Code = "help", - Href = "/dashboard/help", - Label = "Help", - SortOrder = 10, - Status = "Active" - }, - new - { - NavItemId = 11, - Code = "ledgers", - Href = "/dashboard/ledgers", - Label = "Ledgers", - SortOrder = 11, - Status = "Active" - }, - new - { - NavItemId = 12, - Code = "accounts", - Href = "/dashboard/accounts", - Label = "Accounts", - SortOrder = 12, - Status = "Active" - }, - new - { - NavItemId = 13, - Code = "sales", - Href = "/dashboard/sales", - Label = "Sales", - SortOrder = 13, - Status = "Active" - }, - new - { - NavItemId = 14, - Code = "production", - Href = "/dashboard/production", - Label = "Production", - SortOrder = 14, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Property("NotificationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("RelatedEntityId") - .HasColumnType("integer"); - - b.Property("RelatedEntityType") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("NotificationId"); - - b.HasIndex("CreatedAt"); - - b.ToTable("notifications", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("NotificationConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("notification_config", null, t => - { - t.HasCheckConstraint("ck_notification_config_singleton", "\"NotificationConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.Property("NotificationConfigModuleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationConfigModuleId")); - - b.Property("EmailEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("InAppEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ModuleKey") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NotificationConfigId") - .HasColumnType("integer"); - - b.Property("SmsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.HasKey("NotificationConfigModuleId"); - - b.HasIndex("ModuleKey") - .IsUnique(); - - b.HasIndex("NotificationConfigId"); - - b.ToTable("notification_config_modules", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.Property("NotificationRecipientId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("NotificationRecipientId")); - - b.Property("IsRead") - .HasColumnType("boolean"); - - b.Property("NotificationId") - .HasColumnType("integer"); - - b.Property("ReadAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("NotificationRecipientId"); - - b.HasIndex("NotificationId"); - - b.HasIndex("UserId", "IsRead", "NotificationId"); - - b.ToTable("notification_recipients", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.Property("SequenceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SequenceId")); - - b.Property("BranchId") - .HasColumnType("integer") - .HasColumnName("branch_id"); - - b.Property("DocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)") - .HasColumnName("doc_type"); - - b.Property("LastNumber") - .HasColumnType("integer") - .HasColumnName("last_number"); - - b.Property("Year") - .HasColumnType("integer") - .HasColumnName("year"); - - b.HasKey("SequenceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocType", "BranchId", "Year") - .IsUnique(); - - b.ToTable("number_sequences", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Property("PayrollLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineId")); - - b.Property("AbsentDays") - .HasColumnType("integer"); - - b.Property("BasicSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("EmployeeId") - .HasColumnType("integer"); - - b.Property("EpfEmployeeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EpfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("EtfEmployerAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("GrossSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("LateDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("LateMinutesTotal") - .HasColumnType("integer"); - - b.Property("LeaveDays") - .HasColumnType("integer"); - - b.Property("LoanDeductionAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("NetSalary") - .HasColumnType("numeric(18,2)"); - - b.Property("NoPayAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OtMinutesTotal") - .HasColumnType("integer"); - - b.Property("OtherDeductionsAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("OvertimeAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("PayrollRunId") - .HasColumnType("integer"); - - b.Property("PresentDays") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("TaxAmount") - .HasColumnType("numeric(18,2)"); - - b.Property("TotalAllowances") - .HasColumnType("numeric(18,2)"); - - b.Property("WorkingDays") - .HasColumnType("integer"); - - b.HasKey("PayrollLineId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("PayrollRunId", "EmployeeId") - .IsUnique(); - - b.ToTable("hr_payroll_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.Property("PayrollLineComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollLineComponentId")); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ComponentCategory") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("SalaryComponentId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.HasKey("PayrollLineComponentId"); - - b.HasIndex("PayrollLineId"); - - b.HasIndex("SalaryComponentId"); - - b.ToTable("hr_payroll_line_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Property("PayrollRunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollRunId")); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GeneratedBy") - .HasColumnType("integer"); - - b.Property("LockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("LockedBy") - .HasColumnType("integer"); - - b.Property("PeriodMonth") - .HasColumnType("integer"); - - b.Property("PeriodYear") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UnlockReason") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("UnlockedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UnlockedBy") - .HasColumnType("integer"); - - b.HasKey("PayrollRunId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("PeriodYear", "PeriodMonth", "BranchId"); - - b.ToTable("hr_payroll_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollStatutorySetting", b => - { - b.Property("PayrollStatutorySettingId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayrollStatutorySettingId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("EpfEmployeeRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EpfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("EtfEmployerRate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("OtMultiplierDefault") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.HasKey("PayrollStatutorySettingId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_payroll_statutory_settings", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.Property("PayslipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PayslipId")); - - b.Property("GeneratedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("PayrollLineId") - .HasColumnType("integer"); - - b.Property("ReleasedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReleasedBy") - .HasColumnType("integer"); - - b.HasKey("PayslipId"); - - b.HasIndex("PayrollLineId") - .IsUnique(); - - b.ToTable("hr_payslips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.Property("PermissionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PermissionId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(80) - .HasColumnType("character varying(80)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SubNavItemId") - .HasColumnType("integer"); - - b.HasKey("PermissionId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.HasIndex("SubNavItemId"); - - b.ToTable("permissions", (string)null); - - b.HasData( - new - { - PermissionId = 1, - Code = "NAV:dashboard", - NavItemId = 1 - }, - new - { - PermissionId = 2, - Code = "NAV:products", - NavItemId = 2 - }, - new - { - PermissionId = 3, - Code = "NAV:procurement.vendors", - SubNavItemId = 30 - }, - new - { - PermissionId = 4, - Code = "NAV:procurement", - NavItemId = 4 - }, - new - { - PermissionId = 5, - Code = "NAV:receiving", - NavItemId = 5 - }, - new - { - PermissionId = 6, - Code = "NAV:stock", - NavItemId = 6 - }, - new - { - PermissionId = 7, - Code = "NAV:warehouses", - NavItemId = 7 - }, - new - { - PermissionId = 8, - Code = "NAV:orders", - NavItemId = 8 - }, - new - { - PermissionId = 9, - Code = "NAV:settings", - NavItemId = 9 - }, - new - { - PermissionId = 10, - Code = "NAV:help", - NavItemId = 10 - }, - new - { - PermissionId = 11, - Code = "NAV:products.item", - SubNavItemId = 1 - }, - new - { - PermissionId = 12, - Code = "NAV:products.category", - SubNavItemId = 2 - }, - new - { - PermissionId = 13, - Code = "NAV:products.brand", - SubNavItemId = 3 - }, - new - { - PermissionId = 14, - Code = "NAV:products.item-type", - SubNavItemId = 4 - }, - new - { - PermissionId = 15, - Code = "NAV:products.uom", - SubNavItemId = 5 - }, - new - { - PermissionId = 16, - Code = "NAV:products.configuration", - SubNavItemId = 6 - }, - new - { - PermissionId = 17, - Code = "NAV:settings.roles", - SubNavItemId = 7 - }, - new - { - PermissionId = 18, - Code = "NAV:settings.users", - SubNavItemId = 8 - }, - new - { - PermissionId = 28, - Code = "NAV:procurement.requisitions", - SubNavItemId = 17 - }, - new - { - PermissionId = 29, - Code = "NAV:procurement.rfqs", - SubNavItemId = 18 - }, - new - { - PermissionId = 30, - Code = "NAV:procurement.purchase-orders", - SubNavItemId = 19 - }, - new - { - PermissionId = 31, - Code = "NAV:procurement.purchase-returns", - SubNavItemId = 20 - }, - new - { - PermissionId = 19, - Code = "NAV:ledgers", - NavItemId = 11 - }, - new - { - PermissionId = 20, - Code = "NAV:ledgers.trial-balance", - SubNavItemId = 9 - }, - new - { - PermissionId = 21, - Code = "NAV:ledgers.balance-sheet", - SubNavItemId = 10 - }, - new - { - PermissionId = 22, - Code = "NAV:ledgers.general-ledger", - SubNavItemId = 11 - }, - new - { - PermissionId = 23, - Code = "NAV:ledgers.profit-and-loss", - SubNavItemId = 12 - }, - new - { - PermissionId = 24, - Code = "NAV:ledgers.cash-flow", - SubNavItemId = 13 - }, - new - { - PermissionId = 25, - Code = "NAV:ledgers.budget-vs-actual", - SubNavItemId = 14 - }, - new - { - PermissionId = 27, - Code = "NAV:ledgers.tax-report", - SubNavItemId = 16 - }, - new - { - PermissionId = 26, - Code = "NAV:accounts.bank-accounts", - SubNavItemId = 15 - }, - new - { - PermissionId = 32, - Code = "NAV:accounts", - NavItemId = 12 - }, - new - { - PermissionId = 33, - Code = "NAV:accounts.cheque-books", - SubNavItemId = 21 - }, - new - { - PermissionId = 34, - Code = "NAV:accounts.received-cheques", - SubNavItemId = 22 - }, - new - { - PermissionId = 35, - Code = "NAV:production", - NavItemId = 14 - }, - new - { - PermissionId = 36, - Code = "NAV:production.templates", - SubNavItemId = 27 - }, - new - { - PermissionId = 37, - Code = "NAV:production.runs", - SubNavItemId = 25 - }, - new - { - PermissionId = 38, - Code = "NAV:production.produced", - SubNavItemId = 26 - }, - new - { - PermissionId = 39, - Code = "NAV:procurement.purchase-invoices", - SubNavItemId = 28 - }, - new - { - PermissionId = 40, - Code = "NAV:settings.branches", - SubNavItemId = 29 - }, - new - { - PermissionId = 41, - Code = "NAV:stock.ledger", - SubNavItemId = 31 - }, - new - { - PermissionId = 42, - Code = "NAV:stock.enquiry", - SubNavItemId = 32 - }, - new - { - PermissionId = 43, - Code = "NAV:stock.valuation", - SubNavItemId = 33 - }, - new - { - PermissionId = 44, - Code = "NAV:stock.transfers", - SubNavItemId = 34 - }, - new - { - PermissionId = 45, - Code = "NAV:stock.adjustments", - SubNavItemId = 35 - }, - new - { - PermissionId = 46, - Code = "NAV:stock.counts", - SubNavItemId = 36 - }, - new - { - PermissionId = 47, - Code = "NAV:stock.reorder-alerts", - SubNavItemId = 37 - }, - new - { - PermissionId = 48, - Code = "NAV:stock.wastage", - SubNavItemId = 38 - }, - new - { - PermissionId = 49, - Code = "NAV:sales.bundle-templates", - SubNavItemId = 23 - }, - new - { - PermissionId = 50, - Code = "NAV:sales.invoices", - SubNavItemId = 40 - }, - new - { - PermissionId = 51, - Code = "NAV:sales.free-issues", - SubNavItemId = 41 - }, - new - { - PermissionId = 52, - Code = "NAV:sales.day-end", - SubNavItemId = 42 - }, - new - { - PermissionId = 53, - Code = "NAV:products.tax-rates", - SubNavItemId = 43 - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.Property("PoLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PoId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Tax") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("PoLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("PoId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("po_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("BatchListsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("BrandsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CustomVariantsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("CustomWarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemImagesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("ItemTypesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SellingPricesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SerialNumbersEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("SubcategoriesEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.Property("WarrantyPeriodsEnabled") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.HasKey("ConfigId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("product_config", null, t => - { - t.HasCheckConstraint("ck_product_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Property("RunId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunId")); - - b.Property("CancelReasonCodeId") - .HasColumnType("integer"); - - b.Property("CompletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("OutputBinId") - .HasColumnType("integer"); - - b.Property("ReworkCount") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("ScaleFactor") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TargetQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("RunId"); - - b.HasIndex("CancelReasonCodeId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("OutputBinId"); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("TemplateId", "Status"); - - b.ToTable("production_runs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Property("TemplateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TemplateId")); - - b.Property("Annotations") - .HasColumnType("jsonb"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TemplateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("production_templates", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Property("PurchaseInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("VendorInvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorInvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("VendorSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("VendorSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.HasKey("PurchaseInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.HasIndex("VendorId", "VendorInvoiceNo"); - - b.ToTable("purchase_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.Property("PurchaseInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoiceLineId")); - - b.Property("GrnId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("VatTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("PurchaseInvoiceLineId"); - - b.HasIndex("GrnId") - .IsUnique(); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.Property("PurchaseInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PurchaseInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("PurchaseInvoiceId") - .HasColumnType("integer"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("PurchaseInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("PurchaseInvoiceId"); - - b.ToTable("purchase_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Property("PoId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PoId")); - - b.Property("ApprovalRequired") - .HasColumnType("boolean"); - - b.Property("ApprovedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ApprovedBy") - .HasColumnType("integer"); - - b.Property("ApproverUserId") - .HasColumnType("integer"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("PoId"); - - b.HasIndex("ApproverUserId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.HasIndex("Status"); - - b.HasIndex("VendorId"); - - b.ToTable("purchase_orders", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("VendorId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("purchase_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.ToTable("purchase_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ReasonCode", b => - { - b.Property("ReasonCodeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReasonCodeId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Context") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("ReasonCodeId"); - - b.HasIndex("Context", "Code") - .IsUnique(); - - b.ToTable("reason_codes", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Property("RequisitionId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequisitionId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequestedBy") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RequisitionId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequestedBy"); - - b.HasIndex("Status"); - - b.ToTable("requisitions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.Property("ReqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RequiredBy") - .HasColumnType("date"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.HasKey("ReqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RequisitionId"); - - b.ToTable("requisition_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Property("RfqId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RequisitionId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RfqId"); - - b.HasIndex("BranchId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("RequisitionId"); - - b.ToTable("rfqs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.Property("RfqLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RfqLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.HasKey("RfqLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RfqId"); - - b.ToTable("rfq_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Role", b => - { - b.Property("RoleId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RoleId")); - - b.Property("AuthRoleId") - .HasColumnType("uuid") - .HasColumnName("auth_role_id"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsSystemRole") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("RoleId"); - - b.HasIndex("AuthRoleId") - .IsUnique(); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("roles", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("PermissionId") - .HasColumnType("integer"); - - b.Property("Actions") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(31); - - b.HasKey("RoleId", "PermissionId"); - - b.HasIndex("PermissionId"); - - b.ToTable("role_permissions", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.Property("RunEdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunEdgeId")); - - b.Property("ChildRunStageId") - .HasColumnType("integer"); - - b.Property("ParentRunStageId") - .HasColumnType("integer"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.HasKey("RunEdgeId"); - - b.HasIndex("ChildRunStageId"); - - b.HasIndex("RunId"); - - b.HasIndex("ParentRunStageId", "ChildRunStageId") - .IsUnique(); - - b.ToTable("run_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Property("RunStageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunStageId")); - - b.Property("ActualEndAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ActualStartAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("FieldValues") - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("TemplateStageId") - .HasColumnType("integer"); - - b.HasKey("RunStageId"); - - b.HasIndex("TemplateStageId"); - - b.HasIndex("RunId", "Status"); - - b.ToTable("run_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.Property("EventId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EventId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EventType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Note") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("Payload") - .HasColumnType("jsonb"); - - b.Property("RunId") - .HasColumnType("integer"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.HasKey("EventId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("UserId"); - - b.HasIndex("RunId", "EventId"); - - b.ToTable("run_stage_events", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.Property("RunInputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunInputId")); - - b.Property("ConsumedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ConsumedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DeliveredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("FromRunOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ReturnedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnedValue") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("RunInputId"); - - b.HasIndex("FromRunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.ToTable("run_stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.Property("RunOutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RunOutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PlannedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ProducedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunStageId") - .HasColumnType("integer"); - - b.Property("ScrapReasonCodeId") - .HasColumnType("integer"); - - b.Property("ScrappedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TransferredQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("RunOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("RunStageId"); - - b.HasIndex("ScrapReasonCodeId"); - - b.HasIndex("UomId"); - - b.ToTable("run_stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalaryComponent", b => - { - b.Property("SalaryComponentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalaryComponentId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("ComponentType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsEpfEtfApplicable") - .HasColumnType("boolean"); - - b.Property("IsTaxable") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SalaryComponentId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_salary_components", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.Property("ConfigId") - .HasColumnType("integer"); - - b.Property("AllowCashCustomer") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowDiscounts") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowFreeItems") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("AllowOverStockSale") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(false); - - b.Property("AllowWarehouseSelection") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("CashCustomerId") - .HasColumnType("integer"); - - b.Property("DefaultWarehouseId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("ConfigId"); - - b.HasIndex("CashCustomerId"); - - b.HasIndex("DefaultWarehouseId"); - - b.HasIndex("UpdatedBy"); - - b.ToTable("sales_config", null, t => - { - t.HasCheckConstraint("ck_sales_config_singleton", "\"ConfigId\" = 1"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Property("SalesDayEndId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesDayEndId")); - - b.Property("BalanceTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BundleCount") - .ValueGeneratedOnAdd() - .HasColumnType("integer") - .HasDefaultValue(0); - - b.Property("BusinessDate") - .HasColumnType("date"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("ClosedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ClosedBy") - .HasColumnType("integer"); - - b.Property("CostOfGoodsSold") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipCount") - .HasColumnType("integer"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("SalesDayEndId"); - - b.HasIndex("ClosedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("CashierUserId", "BusinessDate") - .IsUnique(); - - b.ToTable("sales_day_ends", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Property("SalesInvoiceId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CreatorUserId") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CustomerSnapshotTaxNo") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("InvoiceDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InvoiceNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("InvoiceType") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("B2C"); - - b.Property("NetPayable") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoundOff") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatorUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("InvoiceDate"); - - b.HasIndex("InvoiceNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoices", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.Property("SalesInvoiceLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoiceLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoiceLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesInvoiceId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_invoice_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.Property("SalesInvoicePaymentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesInvoicePaymentId")); - - b.Property("Amount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BankAccountName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("GlBankAccountId") - .HasColumnType("bigint"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("PaymentDate") - .HasColumnType("timestamp with time zone"); - - b.Property("Reference") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("SalesInvoiceId") - .HasColumnType("integer"); - - b.HasKey("SalesInvoicePaymentId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("SalesInvoiceId"); - - b.ToTable("sales_invoice_payments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Property("ReturnId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("ReturnId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_returns", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.Property("ReturnLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReturnLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReturnId") - .HasColumnType("integer"); - - b.Property("SalesInvoiceLineId") - .HasColumnType("integer"); - - b.HasKey("ReturnLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("ReturnId"); - - b.HasIndex("SalesInvoiceLineId"); - - b.ToTable("sales_return_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Property("SalesSlipId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipId")); - - b.Property("BalanceAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("CashierUserId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("integer"); - - b.Property("CustomerSnapshotName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DayEndId") - .HasColumnType("integer"); - - b.Property("DiscountTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("GrandTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PaidAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SlipDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SlipNo") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Draft"); - - b.Property("Subtotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipId"); - - b.HasIndex("CashierUserId"); - - b.HasIndex("CustomerId"); - - b.HasIndex("DayEndId"); - - b.HasIndex("SlipDate"); - - b.HasIndex("SlipNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slips", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.Property("SalesSlipLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SalesSlipLineId")); - - b.Property("BaseCost") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("DiscountAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("DiscountMode") - .HasColumnType("integer"); - - b.Property("DiscountPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("FreeQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("IsFreeIssue") - .HasColumnType("boolean"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LineTotal") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("NetUnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ParentLineId") - .HasColumnType("integer"); - - b.Property("PriceSource") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SalesSlipId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("TaxAmount") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("TaxPct") - .HasPrecision(9, 4) - .HasColumnType("numeric(9,4)"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("SalesSlipLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SalesSlipId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("sales_slip_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.Property("SerialId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SerialId")); - - b.Property("Barcode") - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialNo") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("SerialId"); - - b.HasIndex("Barcode") - .IsUnique(); - - b.HasIndex("ItemId", "SerialNo") - .IsUnique(); - - b.ToTable("serials", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.Property("EdgeId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("EdgeId")); - - b.Property("ChildStageId") - .HasColumnType("integer"); - - b.Property("ParentStageId") - .HasColumnType("integer"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("EdgeId"); - - b.HasIndex("ChildStageId"); - - b.HasIndex("TemplateId"); - - b.HasIndex("ParentStageId", "ChildStageId") - .IsUnique(); - - b.ToTable("stage_edges", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.Property("InputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("InputId")); - - b.Property("FromOutputId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyUnit") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.HasKey("InputId"); - - b.HasIndex("FromOutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.ToTable("stage_inputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.Property("OutputId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("OutputId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("QtyPerBatch") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("StageId") - .HasColumnType("integer"); - - b.Property("UomId") - .HasColumnType("integer"); - - b.HasKey("OutputId"); - - b.HasIndex("ItemId"); - - b.HasIndex("StageId"); - - b.HasIndex("UomId"); - - b.ToTable("stage_outputs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Property("AdjustmentId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjustmentId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlJournalNo") - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("GlPostedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("ReasonCodeId") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("AdjustmentId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("ReasonCodeId"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_adjustments", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.Property("AdjLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AdjLineId")); - - b.Property("AdjustmentId") - .HasColumnType("integer"); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyDelta") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.HasKey("AdjLineId"); - - b.HasIndex("AdjustmentId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_adjustment_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Property("CountId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CountType") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("CountId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("Status"); - - b.HasIndex("WarehouseId"); - - b.ToTable("stock_counts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.Property("CountLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CountLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CountId") - .HasColumnType("integer"); - - b.Property("CountedQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SystemQty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("Variance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("CountLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("CountId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.ToTable("stock_count_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.Property("LayerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LayerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("GrnLineId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyRemaining") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("ReceiptDate") - .HasColumnType("timestamp with time zone"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LayerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("GrnLineId"); - - b.HasIndex("SerialId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("ItemId", "WarehouseId", "ReceiptDate", "LayerId"); - - b.ToTable("stock_layers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.Property("LedgerId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LedgerId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("BinId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Direction") - .IsRequired() - .HasMaxLength(5) - .HasColumnType("character varying(5)"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("QtyBase") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RunningBalance") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SourceDocId") - .HasColumnType("integer"); - - b.Property("SourceDocType") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.Property("UserId") - .HasColumnType("integer"); - - b.Property("Value") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("WarehouseId") - .HasColumnType("integer"); - - b.HasKey("LedgerId"); - - b.HasIndex("BatchId"); - - b.HasIndex("BinId"); - - b.HasIndex("SerialId"); - - b.HasIndex("UserId"); - - b.HasIndex("WarehouseId"); - - b.HasIndex("SourceDocType", "SourceDocId"); - - b.HasIndex("ItemId", "WarehouseId", "CreatedAt"); - - b.HasIndex("ItemId", "WarehouseId", "LedgerId"); - - b.ToTable("stock_ledger", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Property("TransferId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("DestWarehouseId") - .HasColumnType("integer"); - - b.Property("DocNo") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("character varying(30)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("SrcWarehouseId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.HasKey("TransferId"); - - b.HasIndex("BranchId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("DestWarehouseId"); - - b.HasIndex("DocNo") - .IsUnique(); - - b.HasIndex("SrcWarehouseId"); - - b.HasIndex("Status"); - - b.ToTable("stock_transfers", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.Property("TransferLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TransferLineId")); - - b.Property("BatchId") - .HasColumnType("integer"); - - b.Property("DestBinId") - .HasColumnType("integer"); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("Qty") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("QtyReceived") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("SerialId") - .HasColumnType("integer"); - - b.Property("SrcBinId") - .HasColumnType("integer"); - - b.Property("TransferId") - .HasColumnType("integer"); - - b.Property("UnitCost") - .HasPrecision(18, 6) - .HasColumnType("numeric(18,6)"); - - b.HasKey("TransferLineId"); - - b.HasIndex("BatchId"); - - b.HasIndex("DestBinId"); - - b.HasIndex("ItemId"); - - b.HasIndex("SerialId"); - - b.HasIndex("SrcBinId"); - - b.HasIndex("TransferId"); - - b.ToTable("stock_transfer_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.Property("SubCategoryId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubCategoryId")); - - b.Property("CategoryId") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("SubCategoryId"); - - b.HasIndex("Status"); - - b.HasIndex("CategoryId", "Name") - .IsUnique(); - - b.ToTable("subcategories", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.Property("SubNavItemId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("SubNavItemId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Href") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Icon") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Label") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("NavItemId") - .HasColumnType("integer"); - - b.Property("SortOrder") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.HasKey("SubNavItemId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("NavItemId"); - - b.ToTable("sub_nav_items", (string)null); - - b.HasData( - new - { - SubNavItemId = 1, - Code = "products.item", - Href = "/dashboard/products", - Label = "Item", - NavItemId = 2, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 2, - Code = "products.category", - Href = "/dashboard/products/categories", - Label = "Category", - NavItemId = 2, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 3, - Code = "products.brand", - Href = "/dashboard/products/brands", - Label = "Brand", - NavItemId = 2, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 4, - Code = "products.item-type", - Href = "/dashboard/products/item-types", - Label = "Item Type", - NavItemId = 2, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 5, - Code = "products.uom", - Href = "/dashboard/products/uoms", - Label = "UOM", - NavItemId = 2, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 6, - Code = "products.configuration", - Href = "/dashboard/products/settings", - Label = "Configuration", - NavItemId = 2, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 43, - Code = "products.tax-rates", - Href = "/dashboard/products/tax-rates", - Label = "Tax Rates", - NavItemId = 2, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 29, - Code = "settings.branches", - Href = "/dashboard/settings/branches", - Label = "Branches", - NavItemId = 9, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 7, - Code = "settings.roles", - Href = "/dashboard/settings/roles", - Label = "Roles", - NavItemId = 9, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 8, - Code = "settings.users", - Href = "/dashboard/settings/users", - Label = "Users", - NavItemId = 9, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 24, - Code = "settings.notification-config", - Href = "/dashboard/settings/notification-config", - Label = "Notification Config", - NavItemId = 9, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 40, - Code = "sales.invoices", - Href = "/dashboard/sales/invoices", - Label = "Sales", - NavItemId = 13, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 23, - Code = "sales.bundle-templates", - Href = "/dashboard/sales/bundles/templates", - Label = "Bundle Templates", - NavItemId = 13, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 41, - Code = "sales.free-issues", - Href = "/dashboard/sales/free-issues", - Label = "Free Issues", - NavItemId = 13, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 42, - Code = "sales.day-end", - Href = "/dashboard/sales/day-end", - Label = "Day End", - NavItemId = 13, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 30, - Code = "procurement.vendors", - Href = "/dashboard/vendors", - Label = "Vendors", - NavItemId = 4, - SortOrder = 0, - Status = "Active" - }, - new - { - SubNavItemId = 17, - Code = "procurement.requisitions", - Href = "/dashboard/procurement/requisitions", - Label = "Requisitions", - NavItemId = 4, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 18, - Code = "procurement.rfqs", - Href = "/dashboard/procurement/rfqs", - Label = "RFQs", - NavItemId = 4, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 19, - Code = "procurement.purchase-orders", - Href = "/dashboard/procurement/purchase-orders", - Label = "Purchase Orders", - NavItemId = 4, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 20, - Code = "procurement.purchase-returns", - Href = "/dashboard/procurement/purchase-returns", - Label = "Purchase Returns", - NavItemId = 4, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 28, - Code = "procurement.purchase-invoices", - Href = "/dashboard/procurement/purchase-invoices", - Label = "Purchase Invoices", - NavItemId = 4, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 9, - Code = "ledgers.trial-balance", - Href = "/dashboard/ledgers/trial-balance", - Label = "Trial Balance", - NavItemId = 11, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 10, - Code = "ledgers.balance-sheet", - Href = "/dashboard/ledgers/balance-sheet", - Label = "Balance Sheet", - NavItemId = 11, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 11, - Code = "ledgers.general-ledger", - Href = "/dashboard/ledgers/general-ledger", - Label = "General Ledger", - NavItemId = 11, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 12, - Code = "ledgers.profit-and-loss", - Href = "/dashboard/ledgers/profit-and-loss", - Label = "Profit & Loss", - NavItemId = 11, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 13, - Code = "ledgers.cash-flow", - Href = "/dashboard/ledgers/cash-flow", - Label = "Cash Flow", - NavItemId = 11, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 14, - Code = "ledgers.budget-vs-actual", - Href = "/dashboard/ledgers/budget-vs-actual", - Label = "Budget vs Actual", - NavItemId = 11, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 16, - Code = "ledgers.tax-report", - Href = "/dashboard/ledgers/tax-report", - Label = "Tax Report", - NavItemId = 11, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 15, - Code = "accounts.bank-accounts", - Href = "/dashboard/accounts/bank-accounts", - Label = "Cash / Bank Accounts", - NavItemId = 12, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 21, - Code = "accounts.cheque-books", - Href = "/dashboard/accounts/cheque-books", - Label = "Cheque Books", - NavItemId = 12, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 22, - Code = "accounts.received-cheques", - Href = "/dashboard/accounts/received-cheques", - Label = "Received Cheques", - NavItemId = 12, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 27, - Code = "production.templates", - Href = "/dashboard/production/templates", - Label = "Templates", - NavItemId = 14, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 25, - Code = "production.runs", - Href = "/dashboard/production/runs", - Label = "Runs", - NavItemId = 14, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 26, - Code = "production.produced", - Href = "/dashboard/production/produced", - Label = "Produced", - NavItemId = 14, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 31, - Code = "stock.ledger", - Href = "/dashboard/stock/ledger", - Label = "Stock Ledger", - NavItemId = 6, - SortOrder = 1, - Status = "Active" - }, - new - { - SubNavItemId = 32, - Code = "stock.enquiry", - Href = "/dashboard/stock/enquiry", - Label = "Stock Enquiry", - NavItemId = 6, - SortOrder = 2, - Status = "Active" - }, - new - { - SubNavItemId = 33, - Code = "stock.valuation", - Href = "/dashboard/stock/valuation", - Label = "Valuation", - NavItemId = 6, - SortOrder = 3, - Status = "Active" - }, - new - { - SubNavItemId = 34, - Code = "stock.transfers", - Href = "/dashboard/stock/transfers", - Label = "Transfers", - NavItemId = 6, - SortOrder = 4, - Status = "Active" - }, - new - { - SubNavItemId = 35, - Code = "stock.adjustments", - Href = "/dashboard/stock/adjustments", - Label = "Adjustments", - NavItemId = 6, - SortOrder = 5, - Status = "Active" - }, - new - { - SubNavItemId = 36, - Code = "stock.counts", - Href = "/dashboard/stock/counts", - Label = "Counts", - NavItemId = 6, - SortOrder = 6, - Status = "Active" - }, - new - { - SubNavItemId = 37, - Code = "stock.reorder-alerts", - Href = "/dashboard/stock/reorder-alerts", - Label = "Reorder Alerts", - NavItemId = 6, - SortOrder = 7, - Status = "Active" - }, - new - { - SubNavItemId = 38, - Code = "stock.wastage", - Href = "/dashboard/stock/wastage", - Label = "Wastage", - NavItemId = 6, - SortOrder = 8, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Property("TicketId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TicketId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("integer"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Subject") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("UpdatedBy") - .HasColumnType("integer"); - - b.HasKey("TicketId"); - - b.HasIndex("CreatedBy"); - - b.HasIndex("Status"); - - b.ToTable("support_tickets", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.Property("MessageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("MessageId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("IsFromAdmin") - .HasColumnType("boolean"); - - b.Property("Message") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("character varying(2000)"); - - b.Property("SenderUserId") - .HasColumnType("integer"); - - b.Property("TicketId") - .HasColumnType("integer"); - - b.HasKey("MessageId"); - - b.HasIndex("TicketId", "CreatedAt"); - - b.ToTable("support_ticket_messages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxRate", b => - { - b.Property("TaxRateId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxRateId")); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.Property("Percentage") - .HasPrecision(5, 2) - .HasColumnType("numeric(5,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("TaxRateId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("tax_rates", (string)null); - - b.HasData( - new - { - TaxRateId = 1, - Code = "STANDARD", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Standard", - Percentage = 15m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 2, - Code = "ZERO", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Zero-Rated", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }, - new - { - TaxRateId = 3, - Code = "EXEMPT", - CreatedAt = new DateTime(2026, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - Name = "Exempt", - Percentage = 0m, - RowVersion = 0u, - Status = "Active" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TaxSlab", b => - { - b.Property("TaxSlabId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TaxSlabId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveFrom") - .HasColumnType("timestamp with time zone"); - - b.Property("EffectiveTo") - .HasColumnType("timestamp with time zone"); - - b.Property("LowerBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Rate") - .HasPrecision(6, 4) - .HasColumnType("numeric(6,4)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("UpperBound") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.HasKey("TaxSlabId"); - - b.HasIndex("EffectiveFrom"); - - b.ToTable("hr_tax_slabs", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Property("StageId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("StageId")); - - b.Property("EstimatedMinutes") - .HasColumnType("integer"); - - b.Property("FieldDefs") - .IsRequired() - .HasColumnType("jsonb"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("character varying(150)"); - - b.Property("PosX") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("PosY") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.Property("RoleLabel") - .HasMaxLength(60) - .HasColumnType("character varying(60)"); - - b.Property("TemplateId") - .HasColumnType("integer"); - - b.HasKey("StageId"); - - b.HasIndex("TemplateId"); - - b.ToTable("template_stages", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Uom", b => - { - b.Property("UomId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UomId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("UomId"); - - b.HasIndex("Name") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("uoms", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.Property("UserId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserId")); - - b.Property("AuthUserId") - .HasColumnType("uuid") - .HasColumnName("auth_user_id"); - - b.Property("DisplayName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Email") - .HasMaxLength(320) - .HasColumnType("character varying(320)"); - - b.Property("RoleId") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("Username") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("character varying(100)"); - - b.HasKey("UserId"); - - b.HasIndex("AuthUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.HasIndex("RoleId"); - - b.HasIndex("Username") - .IsUnique(); - - b.ToTable("users", (string)null); - - b.HasData( - new - { - UserId = 1, - DisplayName = "System", - Status = "Active", - Username = "system" - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.Property("VendorId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("VendorId")); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Currency") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(3) - .HasColumnType("character varying(3)") - .HasDefaultValue("LKR"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("TaxReg") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Terms") - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("VendorId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("vendors", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Property("QuotationId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("RfqId") - .HasColumnType("integer"); - - b.Property("VendorId") - .HasColumnType("integer"); - - b.HasKey("QuotationId"); - - b.HasIndex("VendorId"); - - b.HasIndex("RfqId", "VendorId") - .IsUnique(); - - b.ToTable("vendor_quotations", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.Property("QuotationLineId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("QuotationLineId")); - - b.Property("ItemId") - .HasColumnType("integer"); - - b.Property("LeadDays") - .HasColumnType("integer"); - - b.Property("QuotationId") - .HasColumnType("integer"); - - b.Property("UnitPrice") - .HasPrecision(18, 4) - .HasColumnType("numeric(18,4)"); - - b.HasKey("QuotationLineId"); - - b.HasIndex("ItemId"); - - b.HasIndex("QuotationId"); - - b.ToTable("vendor_quotation_lines", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Property("WarehouseId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarehouseId")); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("BranchId") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("character varying(50)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Phone") - .HasColumnType("text"); - - b.HasKey("WarehouseId"); - - b.HasIndex("BranchId"); - - b.HasIndex("Code") - .IsUnique(); - - b.ToTable("warehouses", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyPeriod", b => - { - b.Property("WarrantyPeriodId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WarrantyPeriodId")); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("Months") - .HasColumnType("integer"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("WarrantyPeriodId"); - - b.HasIndex("Months") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("warranty_periods", null, t => - { - t.HasCheckConstraint("ck_warranty_periods_months", "\"Months\" BETWEEN 1 AND 600"); - }); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b => - { - b.Property("WorkShiftId") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("WorkShiftId")); - - b.Property("BreakMinutes") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("character varying(20)"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("interval"); - - b.Property("GraceMinutes") - .HasColumnType("integer"); - - b.Property("IsOvernight") - .HasColumnType("boolean"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("OtMultiplier") - .HasPrecision(6, 2) - .HasColumnType("numeric(6,2)"); - - b.Property("RowVersion") - .IsConcurrencyToken() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("xid") - .HasColumnName("xmin"); - - b.Property("StandardWorkingMinutes") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("interval"); - - b.Property("Status") - .IsRequired() - .ValueGeneratedOnAdd() - .HasMaxLength(20) - .HasColumnType("character varying(20)") - .HasDefaultValue("Active"); - - b.Property("UpdatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("WorkingDaysMask") - .HasColumnType("integer"); - - b.HasKey("WorkShiftId"); - - b.HasIndex("Code") - .IsUnique(); - - b.HasIndex("Status"); - - b.ToTable("hr_work_shifts", (string)null); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AttendanceRecord", b => - { - b.HasOne("ERPCore.Domain.Entities.AttendanceUploadBatch", "AttendanceUploadBatch") - .WithMany() - .HasForeignKey("AttendanceUploadBatchId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("AttendanceUploadBatch"); - - b.Navigation("Employee"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.AuditLog", b => - { - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Batch", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Bin", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany("Bins") - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BranchConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany() - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("BundleSales") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSale", "BundleSale") - .WithMany("Lines") - .HasForeignKey("BundleSaleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSale"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplateLine", b => - { - b.HasOne("ERPCore.Domain.Entities.BundleSaleTemplate", "BundleSaleTemplate") - .WithMany("Lines") - .HasForeignKey("BundleSaleTemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("BundleSaleTemplate"); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Customer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Branch"); - - b.Navigation("DefaultWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Department", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Employee", "HeadEmployee") - .WithMany() - .HasForeignKey("HeadEmployeeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Department", "ParentDepartment") - .WithMany() - .HasForeignKey("ParentDepartmentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - - b.Navigation("HeadEmployee"); - - b.Navigation("ParentDepartment"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Employee", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Department", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Designation", "Designation") - .WithMany() - .HasForeignKey("DesignationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.EmploymentType", "EmploymentType") - .WithMany() - .HasForeignKey("EmploymentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Employee", "ReportingManager") - .WithMany() - .HasForeignKey("ReportingManagerId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Employee", "UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.WorkShift", "WorkShift") - .WithMany() - .HasForeignKey("WorkShiftId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Department"); - - b.Navigation("Designation"); - - b.Navigation("EmploymentType"); - - b.Navigation("ReportingManager"); - - b.Navigation("User"); - - b.Navigation("WorkShift"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeBankDetail", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeDocument", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.HrDocumentType", "HrDocumentType") - .WithMany() - .HasForeignKey("HrDocumentTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("HrDocumentType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructureLine", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeSalaryStructure", "EmployeeSalaryStructure") - .WithMany("Lines") - .HasForeignKey("EmployeeSalaryStructureId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeSalaryStructure"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany() - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany() - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", "Bin") - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany("Lines") - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PoLine", "PoLine") - .WithMany() - .HasForeignKey("PoLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Bin"); - - b.Navigation("Grn"); - - b.Navigation("Item"); - - b.Navigation("PoLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany("WarrantyNumbers") - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.HasOne("ERPCore.Domain.Entities.Uom", "BaseUom") - .WithMany() - .HasForeignKey("BaseUomId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Brand", "Brand") - .WithMany() - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "DefaultVendor") - .WithMany() - .HasForeignKey("DefaultVendorId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.SubCategory", "SubCategory") - .WithMany() - .HasForeignKey("SubCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TaxRate", "TaxRate") - .WithMany() - .HasForeignKey("TaxRateId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("BaseUom"); - - b.Navigation("Brand"); - - b.Navigation("Category"); - - b.Navigation("DefaultVendor"); - - b.Navigation("SubCategory"); - - b.Navigation("TaxRate"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemImage", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ItemReorder", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany("ReorderSettings") - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveBalance", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LeaveRequest", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.LeaveType", "LeaveType") - .WithMany() - .HasForeignKey("LeaveTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LeaveType"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoanInstallment", b => - { - b.HasOne("ERPCore.Domain.Entities.EmployeeLoan", "EmployeeLoan") - .WithMany("Installments") - .HasForeignKey("EmployeeLoanId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany() - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EmployeeLoan"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.LoginActivity", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfigModule", b => - { - b.HasOne("ERPCore.Domain.Entities.NotificationConfig", "NotificationConfig") - .WithMany("Modules") - .HasForeignKey("NotificationConfigId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NotificationConfig"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationRecipient", b => - { - b.HasOne("ERPCore.Domain.Entities.Notification", "Notification") - .WithMany("Recipients") - .HasForeignKey("NotificationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Notification"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NumberSequence", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Employee", "Employee") - .WithMany() - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PayrollRun", "PayrollRun") - .WithMany("Lines") - .HasForeignKey("PayrollRunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("PayrollRun"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLineComponent", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithMany("Components") - .HasForeignKey("PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalaryComponent", "SalaryComponent") - .WithMany() - .HasForeignKey("SalaryComponentId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("PayrollLine"); - - b.Navigation("SalaryComponent"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Payslip", b => - { - b.HasOne("ERPCore.Domain.Entities.PayrollLine", "PayrollLine") - .WithOne() - .HasForeignKey("ERPCore.Domain.Entities.Payslip", "PayrollLineId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PayrollLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Permission", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany() - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("ERPCore.Domain.Entities.SubNavItem", "SubNavItem") - .WithMany() - .HasForeignKey("SubNavItemId") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("NavItem"); - - b.Navigation("SubNavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PoLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseOrder", "PurchaseOrder") - .WithMany("Lines") - .HasForeignKey("PoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("PurchaseOrder"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "CancelReason") - .WithMany() - .HasForeignKey("CancelReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Bin", "OutputBin") - .WithMany() - .HasForeignKey("OutputBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Runs") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CancelReason"); - - b.Navigation("Creator"); - - b.Navigation("OutputBin"); - - b.Navigation("Template"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Grn", "Grn") - .WithMany() - .HasForeignKey("GrnId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Lines") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Grn"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseInvoice", "PurchaseInvoice") - .WithMany("Payments") - .HasForeignKey("PurchaseInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("PurchaseInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Approver") - .WithMany() - .HasForeignKey("ApproverUserId"); - - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Approver"); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Requisition"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Vendor"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.PurchaseReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Return"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Requester") - .WithMany() - .HasForeignKey("RequestedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requester"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RequisitionLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany("Lines") - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Requisition", "Requisition") - .WithMany() - .HasForeignKey("RequisitionId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Requisition"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RfqLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Lines") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Rfq"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RolePermission", b => - { - b.HasOne("ERPCore.Domain.Entities.Permission", "Permission") - .WithMany() - .HasForeignKey("PermissionId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Permission"); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStage", "ChildRunStage") - .WithMany() - .HasForeignKey("ChildRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "ParentRunStage") - .WithMany() - .HasForeignKey("ParentRunStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Edges") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildRunStage"); - - b.Navigation("ParentRunStage"); - - b.Navigation("Run"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Stages") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "TemplateStage") - .WithMany() - .HasForeignKey("TemplateStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Run"); - - b.Navigation("TemplateStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageEvent", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionRun", "Run") - .WithMany("Events") - .HasForeignKey("RunId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Events") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Run"); - - b.Navigation("RunStage"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.RunStageOutput", "FromRunOutput") - .WithMany() - .HasForeignKey("FromRunOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Inputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromRunOutput"); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.RunStage", "RunStage") - .WithMany("Outputs") - .HasForeignKey("RunStageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ScrapReason") - .WithMany() - .HasForeignKey("ScrapReasonCodeId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("RunStage"); - - b.Navigation("ScrapReason"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesConfig", b => - { - b.HasOne("ERPCore.Domain.Entities.Customer", "CashCustomer") - .WithMany() - .HasForeignKey("CashCustomerId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DefaultWarehouse") - .WithMany() - .HasForeignKey("DefaultWarehouseId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("ERPCore.Domain.Entities.User", "UpdatedByUser") - .WithMany() - .HasForeignKey("UpdatedBy") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CashCustomer"); - - b.Navigation("DefaultWarehouse"); - - b.Navigation("UpdatedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "ClosedByUser") - .WithMany() - .HasForeignKey("ClosedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("ClosedByUser"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatorUserId"); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Lines") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("SalesInvoice"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoice", "SalesInvoice") - .WithMany("Payments") - .HasForeignKey("SalesInvoiceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("SalesInvoice"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Creator"); - - b.Navigation("Customer"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesReturn", "Return") - .WithMany("Lines") - .HasForeignKey("ReturnId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine") - .WithMany() - .HasForeignKey("SalesInvoiceLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Return"); - - b.Navigation("SalesInvoiceLine"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.HasOne("ERPCore.Domain.Entities.User", "CashierUser") - .WithMany() - .HasForeignKey("CashierUserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Customer", "Customer") - .WithMany() - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesDayEnd", "DayEnd") - .WithMany("Slips") - .HasForeignKey("DayEndId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("CashierUser"); - - b.Navigation("Customer"); - - b.Navigation("DayEnd"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.SalesSlip", "SalesSlip") - .WithMany("Lines") - .HasForeignKey("SalesSlipId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("Item"); - - b.Navigation("SalesSlip"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b => - { - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ChildStage") - .WithMany() - .HasForeignKey("ChildStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "ParentStage") - .WithMany() - .HasForeignKey("ParentStageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Edges") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ChildStage"); - - b.Navigation("ParentStage"); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageInput", b => - { - b.HasOne("ERPCore.Domain.Entities.StageOutput", "FromOutput") - .WithMany() - .HasForeignKey("FromOutputId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Inputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("FromOutput"); - - b.Navigation("Item"); - - b.Navigation("Stage"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StageOutput", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.TemplateStage", "Stage") - .WithMany("Outputs") - .HasForeignKey("StageId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Uom", "Uom") - .WithMany() - .HasForeignKey("UomId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Item"); - - b.Navigation("Stage"); - - b.Navigation("Uom"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.ReasonCode", "ReasonCode") - .WithMany() - .HasForeignKey("ReasonCodeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("ReasonCode"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustmentLine", b => - { - b.HasOne("ERPCore.Domain.Entities.StockAdjustment", "Adjustment") - .WithMany("Lines") - .HasForeignKey("AdjustmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Adjustment"); - - b.Navigation("Item"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCountLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockCount", "Count") - .WithMany("Lines") - .HasForeignKey("CountId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Batch"); - - b.Navigation("Count"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLayer", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", "Batch") - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine") - .WithMany() - .HasForeignKey("GrnLineId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", "Serial") - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse") - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Batch"); - - b.Navigation("GrnLine"); - - b.Navigation("Item"); - - b.Navigation("Serial"); - - b.Navigation("Warehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockLedger", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("BinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", null) - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.User", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", null) - .WithMany() - .HasForeignKey("WarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.User", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "DestWarehouse") - .WithMany() - .HasForeignKey("DestWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Warehouse", "SrcWarehouse") - .WithMany() - .HasForeignKey("SrcWarehouseId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - - b.Navigation("Creator"); - - b.Navigation("DestWarehouse"); - - b.Navigation("SrcWarehouse"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Batch", null) - .WithMany() - .HasForeignKey("BatchId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("DestBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Serial", null) - .WithMany() - .HasForeignKey("SerialId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.Bin", null) - .WithMany() - .HasForeignKey("SrcBinId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("ERPCore.Domain.Entities.StockTransfer", "Transfer") - .WithMany("Lines") - .HasForeignKey("TransferId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Transfer"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b => - { - b.HasOne("ERPCore.Domain.Entities.Category", "Category") - .WithMany("SubCategories") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SubNavItem", b => - { - b.HasOne("ERPCore.Domain.Entities.NavItem", "NavItem") - .WithMany("Children") - .HasForeignKey("NavItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("NavItem"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicketMessage", b => - { - b.HasOne("ERPCore.Domain.Entities.SupportTicket", "Ticket") - .WithMany("Messages") - .HasForeignKey("TicketId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Ticket"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.HasOne("ERPCore.Domain.Entities.ProductionTemplate", "Template") - .WithMany("Stages") - .HasForeignKey("TemplateId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Template"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.User", b => - { - b.HasOne("ERPCore.Domain.Entities.Role", "Role") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Role"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Vendor", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.HasOne("ERPCore.Domain.Entities.Rfq", "Rfq") - .WithMany("Quotations") - .HasForeignKey("RfqId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.Vendor", "Vendor") - .WithMany() - .HasForeignKey("VendorId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Rfq"); - - b.Navigation("Vendor"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotationLine", b => - { - b.HasOne("ERPCore.Domain.Entities.Item", "Item") - .WithMany() - .HasForeignKey("ItemId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("ERPCore.Domain.Entities.VendorQuotation", "Quotation") - .WithMany("Lines") - .HasForeignKey("QuotationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Item"); - - b.Navigation("Quotation"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.HasOne("ERPCore.Domain.Entities.Branch", "Branch") - .WithMany() - .HasForeignKey("BranchId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Branch"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.BundleSaleTemplate", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Category", b => - { - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeLoan", b => - { - b.Navigation("Installments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.EmployeeSalaryStructure", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Grn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b => - { - b.Navigation("WarrantyNumbers"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Item", b => - { - b.Navigation("ReorderSettings"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NavItem", b => - { - b.Navigation("Children"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Notification", b => - { - b.Navigation("Recipients"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.NotificationConfig", b => - { - b.Navigation("Modules"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollLine", b => - { - b.Navigation("Components"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PayrollRun", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionRun", b => - { - b.Navigation("Edges"); - - b.Navigation("Events"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.ProductionTemplate", b => - { - b.Navigation("Edges"); - - b.Navigation("Runs"); - - b.Navigation("Stages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseOrder", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.PurchaseReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Requisition", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Rfq", b => - { - b.Navigation("Lines"); - - b.Navigation("Quotations"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.RunStage", b => - { - b.Navigation("Events"); - - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesDayEnd", b => - { - b.Navigation("BundleSales"); - - b.Navigation("Slips"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoice", b => - { - b.Navigation("Lines"); - - b.Navigation("Payments"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.StockTransfer", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b => - { - b.Navigation("Messages"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.TemplateStage", b => - { - b.Navigation("Inputs"); - - b.Navigation("Outputs"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.VendorQuotation", b => - { - b.Navigation("Lines"); - }); - - modelBuilder.Entity("ERPCore.Domain.Entities.Warehouse", b => - { - b.Navigation("Bins"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.cs b/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.cs deleted file mode 100644 index eab0393..0000000 --- a/Backend/ERPCore/Migrations/20261002064142_AddGrnConfigDiscountsVat.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ERPCore.Migrations -{ - /// - public partial class AddGrnConfigDiscountsVat : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "AllowDiscounts", - table: "grn_config", - type: "boolean", - nullable: false, - defaultValue: true); - - migrationBuilder.AddColumn( - name: "AllowVat", - table: "grn_config", - type: "boolean", - nullable: false, - defaultValue: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "AllowDiscounts", - table: "grn_config"); - - migrationBuilder.DropColumn( - name: "AllowVat", - table: "grn_config"); - } - } -}