diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index b756a86..5f9e40f 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -133,12 +133,6 @@ namespace Marco.Pms.DataAccess.Data public DbSet ProjectServiceMappings { get; set; } public DbSet ProjectOrgMappings { get; set; } - // Inventory - //public DbSet PurchaseOrderStatus { get; set; } - //public DbSet RequisitionStatus { get; set; } - //public DbSet PurchaseStatusMappings { get; set; } - //public DbSet RequisitionStatusMappings { get; set; } - protected override void OnModelCreating(ModelBuilder modelBuilder) { diff --git a/Marco.Pms.Model/Dtos/Activities/CreateWorkStatusMasterDto.cs b/Marco.Pms.Model/Dtos/Activities/CreateWorkStatusMasterDto.cs index 8b99f62..b4ff25f 100644 --- a/Marco.Pms.Model/Dtos/Activities/CreateWorkStatusMasterDto.cs +++ b/Marco.Pms.Model/Dtos/Activities/CreateWorkStatusMasterDto.cs @@ -2,7 +2,7 @@ { public class CreateWorkStatusMasterDto { - public required string Name { get; set; } - public required string Description { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Activities/UpdateWorkStatusMasterDto.cs b/Marco.Pms.Model/Dtos/Activities/UpdateWorkStatusMasterDto.cs index 48dca5d..a40052f 100644 --- a/Marco.Pms.Model/Dtos/Activities/UpdateWorkStatusMasterDto.cs +++ b/Marco.Pms.Model/Dtos/Activities/UpdateWorkStatusMasterDto.cs @@ -3,7 +3,7 @@ public class UpdateWorkStatusMasterDto { public Guid Id { get; set; } - public required string Name { get; set; } - public required string Description { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } } } diff --git a/Marco.Pms.Model/Dtos/Inventory/PurchaseOrderStatusDto.cs b/Marco.Pms.Model/Dtos/Inventory/PurchaseOrderStatusDto.cs deleted file mode 100644 index f04ad08..0000000 --- a/Marco.Pms.Model/Dtos/Inventory/PurchaseOrderStatusDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Inventory -{ - public class PurchaseOrderStatusDto - { - public Guid? Id { get; set; } - public required string Name { get; set; } - public required string Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Dtos/Inventory/RequisitionStatusDto.cs b/Marco.Pms.Model/Dtos/Inventory/RequisitionStatusDto.cs deleted file mode 100644 index c5cc491..0000000 --- a/Marco.Pms.Model/Dtos/Inventory/RequisitionStatusDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Dtos.Inventory -{ - public class RequisitionStatusDto - { - public Guid? Id { get; set; } - public required string Name { get; set; } - public required string Description { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/Item.cs b/Marco.Pms.Model/Inventory/Item.cs deleted file mode 100644 index e4525b2..0000000 --- a/Marco.Pms.Model/Inventory/Item.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Master; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class Item : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - public Guid ItemGroupId { get; set; } - - [ValidateNever] - [ForeignKey("ItemGroupId")] - public ItemGroupMaster? ItemGroup { get; set; } - public Guid TechnicalUnitId { get; set; } - - [ValidateNever] - [ForeignKey("TechnicalUnitId")] - public TechnicalUnit? ItemCategTechnicalUnitory { get; set; } - public string ItemUId { get; set; } = "Item-00001"; - public int Threshold { get; set; } - public bool IsActive { get; set; } = true; - public DateTime CreatedAt { get; set; } - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - public DateTime? UpdatedAt { get; set; } - public Guid? UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? UpdatedBy { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/ItemCategoryMaster.cs b/Marco.Pms.Model/Inventory/ItemCategoryMaster.cs deleted file mode 100644 index f390fd4..0000000 --- a/Marco.Pms.Model/Inventory/ItemCategoryMaster.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Inventory -{ - public class ItemCategoryMaster : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Inventory/ItemGroupMaster.cs b/Marco.Pms.Model/Inventory/ItemGroupMaster.cs deleted file mode 100644 index 9a468e4..0000000 --- a/Marco.Pms.Model/Inventory/ItemGroupMaster.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class ItemGroupMaster - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - public bool IsActive { get; set; } = true; - public Guid ItemCategoryId { get; set; } - - [ValidateNever] - [ForeignKey("ItemCategoryId")] - public ItemCategoryMaster? ItemCategory { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/ItemManufacturerMapping.cs b/Marco.Pms.Model/Inventory/ItemManufacturerMapping.cs deleted file mode 100644 index 1f8a82b..0000000 --- a/Marco.Pms.Model/Inventory/ItemManufacturerMapping.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Marco.Pms.Model.Master; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class ItemManufacturerMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ItemId { get; set; } - - [ValidateNever] - [ForeignKey("ItemId")] - public Item? Item { get; set; } - public Guid ManufacturerId { get; set; } - - [ValidateNever] - [ForeignKey("ManufacturerId")] - public Manufacturer? Manufacturer { get; set; } - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Inventory/ItemSupplierMapping.cs b/Marco.Pms.Model/Inventory/ItemSupplierMapping.cs deleted file mode 100644 index 4348ef5..0000000 --- a/Marco.Pms.Model/Inventory/ItemSupplierMapping.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Marco.Pms.Model.Master; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class ItemSupplierMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ItemManufacturerMappingId { get; set; } - - [ValidateNever] - [ForeignKey("ItemManufacturerMappingId")] - public ItemManufacturerMapping? ItemManufacturerMapping { get; set; } - public Guid SupplierId { get; set; } - - [ValidateNever] - [ForeignKey("SupplierId")] - public Supplier? Supplier { get; set; } - public double BasePrice { get; set; } - public int PurchaseLeadTime { get; set; } - public Guid CurrencyId { get; set; } - - [ValidateNever] - [ForeignKey("CurrencyId")] - public CurrencyMaster? Currency { get; set; } - public bool IsActive { get; set; } = true; - } -} - diff --git a/Marco.Pms.Model/Inventory/ItemTaxTypeMapping.cs b/Marco.Pms.Model/Inventory/ItemTaxTypeMapping.cs deleted file mode 100644 index d225d3e..0000000 --- a/Marco.Pms.Model/Inventory/ItemTaxTypeMapping.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Marco.Pms.Model.Master; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class ItemTaxTypeMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid ItemId { get; set; } - - [ValidateNever] - [ForeignKey("ItemId")] - public Item? Item { get; set; } - public Guid ServicesTaxTypeId { get; set; } - - [ValidateNever] - [ForeignKey("ServicesTaxTypeId")] - public ServicesTaxType? ServicesTaxType { get; set; } - public int Rate { get; set; } - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Inventory/PurchaseOrder.cs b/Marco.Pms.Model/Inventory/PurchaseOrder.cs deleted file mode 100644 index ade7321..0000000 --- a/Marco.Pms.Model/Inventory/PurchaseOrder.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class PurchaseOrder : TenantRelation - { - public Guid Id { get; set; } - public Guid ItemSupplierMappingId { get; set; } - - [ValidateNever] - [ForeignKey("ItemSupplierMappingId")] - public ItemSupplierMapping? ItemSupplierMapping { get; set; } - public Guid ProjectId { get; set; } - - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid RequisitionBatchId { get; set; } - public int NumberOfItems { get; set; } - public double PricePerItem { get; set; } - public double TotalBasePrice { get; set; } - public double TotalTaxPrice { get; set; } - public double TotalDiscountPrice { get; set; } - public double TotalPrice { get; set; } - public Guid PurchaseOrderStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PurchaseOrderStatusId")] - public PurchaseOrderStatus? PurchaseOrderStatus { get; set; } - public Guid BatchId { get; set; } - public string PurchaseOrderUId { get; set; } = "PO-00001"; - public bool IsActive { get; set; } = true; - public DateTime CreatedAt { get; set; } - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - public DateTime? UpdatedAt { get; set; } - public Guid? UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? UpdatedBy { get; set; } - } -} \ No newline at end of file diff --git a/Marco.Pms.Model/Inventory/PurchaseOrderStatus.cs b/Marco.Pms.Model/Inventory/PurchaseOrderStatus.cs deleted file mode 100644 index 4625a1d..0000000 --- a/Marco.Pms.Model/Inventory/PurchaseOrderStatus.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Inventory -{ - public class PurchaseOrderStatus : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - public bool IsActive { get; set; } = true; - } -} \ No newline at end of file diff --git a/Marco.Pms.Model/Inventory/PurchaseOrderStatusLogs.cs b/Marco.Pms.Model/Inventory/PurchaseOrderStatusLogs.cs deleted file mode 100644 index 5ee91f2..0000000 --- a/Marco.Pms.Model/Inventory/PurchaseOrderStatusLogs.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class PurchaseOrderStatusLogs : TenantRelation - { - public Guid Id { get; set; } - public Guid PreviousPurchaseStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PreviousPurchaseStatusId")] - public PurchaseOrderStatus? PreviousPurchaseStatus { get; set; } - public string? Comment { get; set; } - public Guid PurchaseStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PurchaseStatusId")] - public PurchaseOrderStatus? PurchaseStatus { get; set; } - public DateTime UpdatedAt { get; set; } - public Guid UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? UpdatedBy { get; set; } - } -} \ No newline at end of file diff --git a/Marco.Pms.Model/Inventory/PurchaseStatusEmployeeMapping.cs b/Marco.Pms.Model/Inventory/PurchaseStatusEmployeeMapping.cs deleted file mode 100644 index 78673a1..0000000 --- a/Marco.Pms.Model/Inventory/PurchaseStatusEmployeeMapping.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Master; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class PurchaseStatusEmployeeMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid PurchaseOrderStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PurchaseOrderStatusId")] - public PurchaseOrderStatus? PurchaseOrderStatus { get; set; } - public Guid EmployeeId { get; set; } - - [ValidateNever] - [ForeignKey("EmployeeId")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/PurchaseStatusMapping.cs b/Marco.Pms.Model/Inventory/PurchaseStatusMapping.cs deleted file mode 100644 index f9ec199..0000000 --- a/Marco.Pms.Model/Inventory/PurchaseStatusMapping.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class PurchaseStatusMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid PreviousPurchaseStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PreviousPurchaseStatusId")] - public PurchaseOrderStatus? PreviousPurchaseStatus { get; set; } - public Guid PurchaseStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PurchaseStatusId")] - public PurchaseOrderStatus? PurchaseStatus { get; set; } - public Guid NextPurchaseStatusId { get; set; } - - [ValidateNever] - [ForeignKey("NextPurchaseStatusId")] - public PurchaseOrderStatus? NextPurchaseStatus { get; set; } - } -} \ No newline at end of file diff --git a/Marco.Pms.Model/Inventory/Requisition.cs b/Marco.Pms.Model/Inventory/Requisition.cs deleted file mode 100644 index 755da90..0000000 --- a/Marco.Pms.Model/Inventory/Requisition.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Marco.Pms.Model.Employees; -using Marco.Pms.Model.Projects; -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class Requisition : TenantRelation - { - public Guid Id { get; set; } - public Guid ItemId { get; set; } - - [ValidateNever] - [ForeignKey("ItemId")] - public Item? Item { get; set; } - public Guid ProjectId { get; set; } - - [ValidateNever] - [ForeignKey("ProjectId")] - public Project? Project { get; set; } - public Guid BatchId { get; set; } - public int NumberOfItems { get; set; } - public Guid RequisitionStatusId { get; set; } - - [ValidateNever] - [ForeignKey("RequisitionStatusId")] - public RequisitionStatus? RequisitionStatus { get; set; } - public string RequisitionUId { get; set; } = "Requisition-00001"; - public bool IsActive { get; set; } = true; - public DateTime CreatedAt { get; set; } - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - public DateTime? UpdatedAt { get; set; } - public Guid? UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? UpdatedBy { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/RequisitionStatus.cs b/Marco.Pms.Model/Inventory/RequisitionStatus.cs deleted file mode 100644 index cd0023a..0000000 --- a/Marco.Pms.Model/Inventory/RequisitionStatus.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Marco.Pms.Model.Utilities; - -namespace Marco.Pms.Model.Inventory -{ - public class RequisitionStatus : TenantRelation - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - public bool IsActive { get; set; } = true; - } -} diff --git a/Marco.Pms.Model/Inventory/RequisitionStatusEmployeeMapping.cs b/Marco.Pms.Model/Inventory/RequisitionStatusEmployeeMapping.cs deleted file mode 100644 index c6c0f6e..0000000 --- a/Marco.Pms.Model/Inventory/RequisitionStatusEmployeeMapping.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class RequisitionStatusEmployeeMapping - { - public Guid Id { get; set; } - public Guid RequisitionStatusId { get; set; } - - [ValidateNever] - [ForeignKey("RequisitionStatusId")] - public RequisitionStatus? RequisitionStatus { get; set; } - public Guid EmployeeId { get; set; } - - [ValidateNever] - [ForeignKey("EmployeeId")] - public Employee? Employee { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/RequisitionStatusLogs.cs b/Marco.Pms.Model/Inventory/RequisitionStatusLogs.cs deleted file mode 100644 index a580e21..0000000 --- a/Marco.Pms.Model/Inventory/RequisitionStatusLogs.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class RequisitionStatusLogs - { - public Guid Id { get; set; } - public Guid PreviousRequisitionStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PreviousRequisitionStatusId")] - public PurchaseOrderStatus? PreviousRequisitionStatus { get; set; } - public string? Comment { get; set; } - public Guid RequisitionStatusId { get; set; } - - [ValidateNever] - [ForeignKey("RequisitionStatusId")] - public RequisitionStatus? RequisitionStatus { get; set; } - public DateTime UpdatedAt { get; set; } - public Guid UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? UpdatedBy { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/RequisitionStatusMapping.cs b/Marco.Pms.Model/Inventory/RequisitionStatusMapping.cs deleted file mode 100644 index 6590a38..0000000 --- a/Marco.Pms.Model/Inventory/RequisitionStatusMapping.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Marco.Pms.Model.Utilities; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class RequisitionStatusMapping : TenantRelation - { - public Guid Id { get; set; } - public Guid PreviousRequisitionStatusId { get; set; } - - [ValidateNever] - [ForeignKey("PreviousRequisitionStatusId")] - public RequisitionStatus? PreviousRequisitionStatus { get; set; } - public Guid RequisitionStatusId { get; set; } - - [ValidateNever] - [ForeignKey("RequisitionStatusId")] - public RequisitionStatus? RequisitionStatus { get; set; } - public Guid NextRequisitionStatusId { get; set; } - - [ValidateNever] - [ForeignKey("NextRequisitionStatusId")] - public RequisitionStatus? NextRequisitionStatus { get; set; } - } -} diff --git a/Marco.Pms.Model/Inventory/Supplier.cs b/Marco.Pms.Model/Inventory/Supplier.cs deleted file mode 100644 index b1f95e6..0000000 --- a/Marco.Pms.Model/Inventory/Supplier.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Marco.Pms.Model.Employees; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class Supplier - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string? Email { get; set; } - public string SupplierGroup { get; set; } = default!; - public string BankName { get; set; } = default!; - public string AccountNumber { get; set; } = default!; - public string IFSC { get; set; } = default!; - public string SupplierUId { get; set; } = "Supplier-00001"; - public bool IsActive { get; set; } = true; - public DateTime CreatedAt { get; set; } - public Guid CreatedById { get; set; } - - [ValidateNever] - [ForeignKey("CreatedById")] - public Employee? CreatedBy { get; set; } - public DateTime? UpdatedAt { get; set; } - public Guid? UpdatedById { get; set; } - - [ValidateNever] - [ForeignKey("UpdatedById")] - public Employee? UpdatedBy { get; set; } - } -} \ No newline at end of file diff --git a/Marco.Pms.Model/Inventory/SupplierStateMapping.cs b/Marco.Pms.Model/Inventory/SupplierStateMapping.cs deleted file mode 100644 index 0a92c99..0000000 --- a/Marco.Pms.Model/Inventory/SupplierStateMapping.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Marco.Pms.Model.Master; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Inventory -{ - public class SupplierStateMapping - { - public Guid Id { get; set; } - public Guid StateId { get; set; } - - [ValidateNever] - [ForeignKey("StateId")] - public StateMaster? State { get; set; } - public string Street { get; set; } = default!; - public string CityName { get; set; } = default!; - public string PinCode { get; set; } = default!; - public string Country { get; set; } = default!; - public string GSTNumber { get; set; } = default!; - public string ContactPerson { get; set; } = default!; - public string ContactEmail { get; set; } = default!; - public string ContactPhone { get; set; } = default!; - public Guid SupplierId { get; set; } - - [ValidateNever] - [ForeignKey("SupplierId")] - public Supplier? Supplier { get; set; } - } -} \ No newline at end of file diff --git a/Marco.Pms.Model/Master/Manufacturer.cs b/Marco.Pms.Model/Master/Manufacturer.cs deleted file mode 100644 index 8289184..0000000 --- a/Marco.Pms.Model/Master/Manufacturer.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Master -{ - public class Manufacturer - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - } -} diff --git a/Marco.Pms.Model/Master/ServicesTaxType.cs b/Marco.Pms.Model/Master/ServicesTaxType.cs deleted file mode 100644 index 565b15f..0000000 --- a/Marco.Pms.Model/Master/ServicesTaxType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Master -{ - public class ServicesTaxType - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - } -} diff --git a/Marco.Pms.Model/Master/StateMaster.cs b/Marco.Pms.Model/Master/StateMaster.cs deleted file mode 100644 index 60b87b8..0000000 --- a/Marco.Pms.Model/Master/StateMaster.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.Master -{ - public class StateMaster - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - public int StateCode { get; set; } = default!; - } -} diff --git a/Marco.Pms.Model/Master/TaxSlabMaster.cs b/Marco.Pms.Model/Master/TaxSlabMaster.cs deleted file mode 100644 index acb3464..0000000 --- a/Marco.Pms.Model/Master/TaxSlabMaster.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Marco.Pms.Model.Master -{ - public class TaxSlabMaster - { - public Guid Id { get; set; } - public int Percentage { get; set; } - } -} \ No newline at end of file diff --git a/Marco.Pms.Model/Master/TechnicalUnit.cs b/Marco.Pms.Model/Master/TechnicalUnit.cs deleted file mode 100644 index cfd0567..0000000 --- a/Marco.Pms.Model/Master/TechnicalUnit.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Marco.Pms.Model.Master -{ - public class TechnicalUnit - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - public Guid UnitTypeId { get; set; } - - [ValidateNever] - [ForeignKey("UnitTypeId")] - public UnitType? UnitType { get; set; } - } -} diff --git a/Marco.Pms.Model/Master/UnitType.cs b/Marco.Pms.Model/Master/UnitType.cs deleted file mode 100644 index a87e9ef..0000000 --- a/Marco.Pms.Model/Master/UnitType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Marco.Pms.Model.Master -{ - public class UnitType - { - public Guid Id { get; set; } - public string Name { get; set; } = default!; - public string Description { get; set; } = default!; - } -} diff --git a/Marco.Pms.Model/ViewModels/Inventory/PurchaseOrderStatusDetailsVM.cs b/Marco.Pms.Model/ViewModels/Inventory/PurchaseOrderStatusDetailsVM.cs deleted file mode 100644 index 1a905fe..0000000 --- a/Marco.Pms.Model/ViewModels/Inventory/PurchaseOrderStatusDetailsVM.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Inventory -{ - public class PurchaseOrderStatusDetailsVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - public bool IsActive { get; set; } - public List? PreviousPurchaseStatus { get; set; } - public List? NextPurchaseStatus { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Inventory/PurchaseOrderStatusVM.cs b/Marco.Pms.Model/ViewModels/Inventory/PurchaseOrderStatusVM.cs deleted file mode 100644 index a3580c7..0000000 --- a/Marco.Pms.Model/ViewModels/Inventory/PurchaseOrderStatusVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Inventory -{ - public class PurchaseOrderStatusVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - public bool IsActive { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Inventory/RequisitionStatusDetailsVM.cs b/Marco.Pms.Model/ViewModels/Inventory/RequisitionStatusDetailsVM.cs deleted file mode 100644 index ac21a4f..0000000 --- a/Marco.Pms.Model/ViewModels/Inventory/RequisitionStatusDetailsVM.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Inventory -{ - public class RequisitionStatusDetailsVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - public bool IsActive { get; set; } - public List? PreviousRequisitionStatus { get; set; } - public List? NextRequisitionStatus { get; set; } - } -} diff --git a/Marco.Pms.Model/ViewModels/Inventory/RequisitionStatusVM.cs b/Marco.Pms.Model/ViewModels/Inventory/RequisitionStatusVM.cs deleted file mode 100644 index 78d3653..0000000 --- a/Marco.Pms.Model/ViewModels/Inventory/RequisitionStatusVM.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Marco.Pms.Model.ViewModels.Inventory -{ - public class RequisitionStatusVM - { - public Guid Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - public bool IsActive { get; set; } - } -} diff --git a/Marco.Pms.Services/Service/MasterService.cs b/Marco.Pms.Services/Service/MasterService.cs index 3503a17..091ba3c 100644 --- a/Marco.Pms.Services/Service/MasterService.cs +++ b/Marco.Pms.Services/Service/MasterService.cs @@ -1863,9 +1863,9 @@ namespace Marco.Pms.Services.Service return ApiResponse.ErrorResponse("An error occurred", "Unable to fetch work status list", 500); } } - public async Task> CreateWorkStatus(CreateWorkStatusMasterDto model, Employee loggedInEmployee, Guid tenantId) + public async Task> CreateWorkStatus(CreateWorkStatusMasterDto createWorkStatusDto, Employee loggedInEmployee, Guid tenantId) { - _logger.LogInfo("CreateWorkStatus called with Name: {Name}", model.Name); + _logger.LogInfo("CreateWorkStatus called with Name: {Name}", createWorkStatusDto.Name ?? ""); try { @@ -1880,19 +1880,19 @@ namespace Marco.Pms.Services.Service // Step 2: Check if work status with the same name already exists var existingWorkStatus = await _context.WorkStatusMasters - .FirstOrDefaultAsync(ws => ws.Name == model.Name && ws.TenantId == tenantId); + .FirstOrDefaultAsync(ws => ws.Name == createWorkStatusDto.Name && ws.TenantId == tenantId); if (existingWorkStatus != null) { - _logger.LogWarning("Work status already exists: {Name}", model.Name); + _logger.LogWarning("Work status already exists: {Name}", createWorkStatusDto.Name ?? ""); return ApiResponse.ErrorResponse("Work status already exists", "Work status already exists", 400); } // Step 3: Create new WorkStatusMaster entry var workStatus = new WorkStatusMaster { - Name = model.Name.Trim(), - Description = model.Description.Trim(), + Name = createWorkStatusDto.Name?.Trim() ?? "", + Description = createWorkStatusDto.Description?.Trim() ?? "", IsSystem = false, TenantId = tenantId }; @@ -1909,16 +1909,16 @@ namespace Marco.Pms.Services.Service return ApiResponse.ErrorResponse("An error occurred", "Unable to create work status", 500); } } - public async Task> UpdateWorkStatus(Guid id, UpdateWorkStatusMasterDto model, Employee loggedInEmployee, Guid tenantId) + public async Task> UpdateWorkStatus(Guid id, UpdateWorkStatusMasterDto updateWorkStatusDto, Employee loggedInEmployee, Guid tenantId) { - _logger.LogInfo("UpdateWorkStatus called for WorkStatus ID: {Id}, New Name: {Name}", id, model.Name); + _logger.LogInfo("UpdateWorkStatus called for WorkStatus ID: {Id}, New Name: {Name}", id, updateWorkStatusDto.Name ?? ""); try { // Step 1: Validate input - if (id == Guid.Empty || id != model.Id) + if (id == Guid.Empty || id != updateWorkStatusDto.Id) { - _logger.LogWarning("Invalid ID provided for update. Route ID: {RouteId}, DTO ID: {DtoId}", id, model.Id); + _logger.LogWarning("Invalid ID provided for update. Route ID: {RouteId}, DTO ID: {DtoId}", id, updateWorkStatusDto.Id); return ApiResponse.ErrorResponse("Invalid data provided", "The provided work status ID is invalid", 400); } @@ -1942,31 +1942,20 @@ namespace Marco.Pms.Services.Service // Step 4: Check for duplicate name (optional) var isDuplicate = await _context.WorkStatusMasters - .AnyAsync(ws => ws.Name == model.Name.Trim() && ws.Id != id && ws.TenantId == tenantId); + .AnyAsync(ws => ws.Name == updateWorkStatusDto.Name && ws.Id != id && ws.TenantId == tenantId); if (isDuplicate) { - _logger.LogWarning("Duplicate work status name '{Name}' detected during update. ID: {Id}", model.Name, id); + _logger.LogWarning("Duplicate work status name '{Name}' detected during update. ID: {Id}", updateWorkStatusDto.Name ?? "", id); return ApiResponse.ErrorResponse("Work status with the same name already exists", "Duplicate name", 400); } - // Capture original state for audit log - var existingEntityBson = _updateLogHelper.EntityToBsonDocument(workStatus); - // Step 5: Update fields - workStatus.Name = model.Name.Trim(); - workStatus.Description = model.Description.Trim(); + workStatus.Name = updateWorkStatusDto.Name?.Trim() ?? ""; + workStatus.Description = updateWorkStatusDto.Description?.Trim() ?? ""; await _context.SaveChangesAsync(); - await _updateLogHelper.PushToUpdateLogsAsync(new UpdateLogsObject - { - EntityId = workStatus.Id.ToString(), - UpdatedById = loggedInEmployee.Id.ToString(), - OldObject = existingEntityBson, - UpdatedAt = DateTime.UtcNow - }, "WorkStatusMasterModificationLog"); - _logger.LogInfo("Work status updated successfully. ID: {Id}", id); return ApiResponse.SuccessResponse(workStatus, "Work status updated successfully", 200); } @@ -2014,21 +2003,10 @@ namespace Marco.Pms.Services.Service ); } - // Capture original state for audit log - var existingEntityBson = _updateLogHelper.EntityToBsonDocument(workStatus); - // Step 5: Delete and persist _context.WorkStatusMasters.Remove(workStatus); await _context.SaveChangesAsync(); - await _updateLogHelper.PushToUpdateLogsAsync(new UpdateLogsObject - { - EntityId = workStatus.Id.ToString(), - UpdatedById = loggedInEmployee.Id.ToString(), - OldObject = existingEntityBson, - UpdatedAt = DateTime.UtcNow - }, "WorkStatusMasterModificationLog"); - _logger.LogInfo("Work status deleted successfully. Id: {Id}", id); return ApiResponse.SuccessResponse(new { }, "Work status deleted successfully", 200); }