revert e02636b6b66287a22fcfb34c150aece1b136cc68
revert Optmized the work status master APIs
This commit is contained in:
parent
e02636b6b6
commit
2f6031e62c
@ -133,12 +133,6 @@ namespace Marco.Pms.DataAccess.Data
|
||||
public DbSet<ProjectServiceMapping> ProjectServiceMappings { get; set; }
|
||||
public DbSet<ProjectOrgMapping> ProjectOrgMappings { get; set; }
|
||||
|
||||
// Inventory
|
||||
//public DbSet<PurchaseOrderStatus> PurchaseOrderStatus { get; set; }
|
||||
//public DbSet<RequisitionStatus> RequisitionStatus { get; set; }
|
||||
//public DbSet<PurchaseStatusMapping> PurchaseStatusMappings { get; set; }
|
||||
//public DbSet<RequisitionStatusMapping> RequisitionStatusMappings { get; set; }
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace Marco.Pms.Model.Master
|
||||
{
|
||||
public class Manufacturer
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -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!;
|
||||
}
|
||||
}
|
@ -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!;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace Marco.Pms.Model.Master
|
||||
{
|
||||
public class TaxSlabMaster
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public int Percentage { get; set; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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!;
|
||||
}
|
||||
}
|
@ -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<PurchaseOrderStatusVM>? PreviousPurchaseStatus { get; set; }
|
||||
public List<PurchaseOrderStatusVM>? NextPurchaseStatus { get; set; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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<RequisitionStatusVM>? PreviousRequisitionStatus { get; set; }
|
||||
public List<RequisitionStatusVM>? NextRequisitionStatus { get; set; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -1863,9 +1863,9 @@ namespace Marco.Pms.Services.Service
|
||||
return ApiResponse<object>.ErrorResponse("An error occurred", "Unable to fetch work status list", 500);
|
||||
}
|
||||
}
|
||||
public async Task<ApiResponse<object>> CreateWorkStatus(CreateWorkStatusMasterDto model, Employee loggedInEmployee, Guid tenantId)
|
||||
public async Task<ApiResponse<object>> 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<object>.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<object>.ErrorResponse("An error occurred", "Unable to create work status", 500);
|
||||
}
|
||||
}
|
||||
public async Task<ApiResponse<object>> UpdateWorkStatus(Guid id, UpdateWorkStatusMasterDto model, Employee loggedInEmployee, Guid tenantId)
|
||||
public async Task<ApiResponse<object>> 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<object>.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<object>.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<object>.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<object>.SuccessResponse(new { }, "Work status deleted successfully", 200);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user