Added GST number and converted all Double SPRID to long
This commit is contained in:
parent
e30aec1791
commit
5b57c93a21
8631
Marco.Pms.DataAccess/Migrations/20251115101806_Added_GSTNumber_In_Organization_Table.Designer.cs
generated
Normal file
8631
Marco.Pms.DataAccess/Migrations/20251115101806_Added_GSTNumber_In_Organization_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_GSTNumber_In_Organization_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "SPRID",
|
||||
table: "TenantOrgMappings",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(double),
|
||||
oldType: "double");
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "SPRID",
|
||||
table: "Organizations",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(double),
|
||||
oldType: "double");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "GSTNumber",
|
||||
table: "Organizations",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Organizations",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("4e3a6d31-c640-40f7-8d67-6c109fcdb9ea"),
|
||||
columns: new[] { "GSTNumber", "SPRID" },
|
||||
values: new object[] { null, 5400L });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GSTNumber",
|
||||
table: "Organizations");
|
||||
|
||||
migrationBuilder.AlterColumn<double>(
|
||||
name: "SPRID",
|
||||
table: "TenantOrgMappings",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint");
|
||||
|
||||
migrationBuilder.AlterColumn<double>(
|
||||
name: "SPRID",
|
||||
table: "Organizations",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Organizations",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("4e3a6d31-c640-40f7-8d67-6c109fcdb9ea"),
|
||||
column: "SPRID",
|
||||
value: 5400.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4492,6 +4492,9 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("GSTNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
@ -4499,8 +4502,8 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<double>("SPRID")
|
||||
.HasColumnType("double");
|
||||
b.Property<long>("SPRID")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
@ -4526,7 +4529,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
Email = "admin@marcoaiot.com",
|
||||
IsActive = true,
|
||||
Name = "MarcoBMS",
|
||||
SPRID = 5400.0
|
||||
SPRID = 5400L
|
||||
});
|
||||
});
|
||||
|
||||
@ -4679,8 +4682,8 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
b.Property<DateTime?>("ReassignedDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<double>("SPRID")
|
||||
.HasColumnType("double");
|
||||
b.Property<long>("SPRID")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<Guid>("TenantId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
public required string ContactPerson { get; set; }
|
||||
public required string Address { get; set; }
|
||||
public required string ContactNumber { get; set; }
|
||||
public string? GSTNumber { get; set; }
|
||||
public string? logoImage { get; set; }
|
||||
public List<Guid>? ServiceIds { get; set; }
|
||||
}
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
public string? Email { get; set; }
|
||||
public string? ContactPerson { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? GSTNumber { get; set; }
|
||||
public string? ContactNumber { get; set; }
|
||||
public double SPRID { get; set; }
|
||||
public long SPRID { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
public string ContactPerson { get; set; } = string.Empty;
|
||||
public string Address { get; set; } = string.Empty;
|
||||
public string ContactNumber { get; set; } = string.Empty;
|
||||
public double SPRID { get; set; }
|
||||
public long SPRID { get; set; }
|
||||
public string? GSTNumber { get; set; }
|
||||
public string? logoImage { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public Guid? CreatedById { get; set; }
|
||||
|
||||
@ -13,7 +13,7 @@ namespace Marco.Pms.Model.OrganizationModel
|
||||
[ValidateNever]
|
||||
[ForeignKey("OrganizationId")]
|
||||
public Organization? Organization { get; set; }
|
||||
public double SPRID { get; set; }
|
||||
public long SPRID { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public Guid AssignedById { get; set; }
|
||||
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
public string? Email { get; set; }
|
||||
public string? ContactPerson { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? GSTNumber { get; set; }
|
||||
public string? ContactNumber { get; set; }
|
||||
public int SPRID { get; set; }
|
||||
public long SPRID { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ namespace Marco.Pms.Model.ViewModels.Organization
|
||||
public string? ContactPerson { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? ContactNumber { get; set; }
|
||||
public double SPRID { get; set; }
|
||||
public long SPRID { get; set; }
|
||||
public int ActiveEmployeeCount { get; set; }
|
||||
public int ActiveApplicationUserCount { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
@ -10,7 +10,8 @@ namespace Marco.Pms.Model.ViewModels.Organization
|
||||
public string? ContactPerson { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? ContactNumber { get; set; }
|
||||
public double SPRID { get; set; }
|
||||
public long SPRID { get; set; }
|
||||
public string? GSTNumber { get; set; }
|
||||
public string? logoImage { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public BasicEmployeeVM? CreatedBy { get; set; }
|
||||
|
||||
@ -9,7 +9,7 @@ namespace Marco.Pms.Model.ViewModels.Organization
|
||||
public string? Name { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? ContactPerson { get; set; }
|
||||
public double SPRID { get; set; }
|
||||
public long SPRID { get; set; }
|
||||
public string? logoImage { get; set; }
|
||||
public string? OrganizationType { get; set; }
|
||||
public DateTime AssignedDate { get; set; }
|
||||
|
||||
@ -37,7 +37,7 @@ namespace Marco.Pms.Services.Controllers
|
||||
#region =================================================================== Get Functions ===================================================================
|
||||
|
||||
[HttpGet("list")]
|
||||
public async Task<IActionResult> GetOrganizarionList([FromQuery] string? searchString, [FromQuery] double? sprid, [FromQuery] bool active = true,
|
||||
public async Task<IActionResult> GetOrganizarionList([FromQuery] string? searchString, [FromQuery] long? sprid, [FromQuery] bool active = true,
|
||||
[FromQuery] int pageNumber = 1, [FromQuery] int pageSize = 20)
|
||||
{
|
||||
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
|
||||
|
||||
@ -488,7 +488,7 @@ namespace Marco.Pms.Services.Controllers
|
||||
{
|
||||
// Get last SPRID and increment for new organization
|
||||
var lastOrganization = await _context.Organizations.OrderByDescending(sp => sp.SPRID).FirstOrDefaultAsync();
|
||||
double lastSPRID = lastOrganization?.SPRID ?? 5400;
|
||||
long lastSPRID = lastOrganization?.SPRID ?? 5400;
|
||||
|
||||
// Map DTO to entity and set defaults
|
||||
Organization organization = new Organization
|
||||
|
||||
@ -55,21 +55,13 @@ namespace Marco.Pms.Services.MappingProfiles
|
||||
|
||||
CreateMap<CreateOrganizationDto, Organization>();
|
||||
CreateMap<Organization, OrganizationVM>();
|
||||
CreateMap<Organization, BasicOrganizationVm>()
|
||||
.ForMember(
|
||||
dest => dest.SPRID,
|
||||
// Explicitly and safely convert double to int
|
||||
opt => opt.MapFrom(src => (int)Math.Round(src.SPRID)));
|
||||
CreateMap<Organization, BasicOrganizationVm>();
|
||||
CreateMap<Organization, OrganizationDetailsVM>();
|
||||
CreateMap<OrganizationMongoDB, BasicOrganizationVm>()
|
||||
.ForMember(
|
||||
dest => dest.Id,
|
||||
// Explicitly and safely convert string Id to Guid Id
|
||||
opt => opt.MapFrom(src => new Guid(src.Id)))
|
||||
.ForMember(
|
||||
dest => dest.SPRID,
|
||||
// Explicitly and safely convert double to int
|
||||
opt => opt.MapFrom(src => (int)Math.Round(src.SPRID)));
|
||||
opt => opt.MapFrom(src => new Guid(src.Id)));
|
||||
CreateMap<OrganizationHierarchy, OrganizationHierarchyVM>();
|
||||
|
||||
#endregion
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
#region =================================================================== Get Functions ===================================================================
|
||||
|
||||
public async Task<ApiResponse<object>> GetOrganizarionListAsync(string? searchString, double? sprid, bool active, int pageNumber, int pageSize, Employee loggedInEmployee, Guid tenantId, Guid loggedOrganizationId)
|
||||
public async Task<ApiResponse<object>> GetOrganizarionListAsync(string? searchString, long? sprid, bool active, int pageNumber, int pageSize, Employee loggedInEmployee, Guid tenantId, Guid loggedOrganizationId)
|
||||
{
|
||||
_logger.LogDebug("Fetching organization list. SearchString: {SearchString}, SPRID: {SPRID}, Active: {Active}, Page: {PageNumber}, Size: {PageSize}",
|
||||
searchString ?? "", sprid ?? 0, active, pageNumber, pageSize);
|
||||
@ -359,7 +359,7 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
// Get last SPRID and increment for new organization
|
||||
var lastOrganization = await _context.Organizations.OrderByDescending(sp => sp.SPRID).FirstOrDefaultAsync();
|
||||
double lastSPRID = lastOrganization?.SPRID ?? 5400;
|
||||
long lastSPRID = lastOrganization?.SPRID ?? 5400;
|
||||
|
||||
// Map DTO to entity and set defaults
|
||||
Organization organization = _mapper.Map<Organization>(model);
|
||||
|
||||
@ -7,7 +7,7 @@ namespace Marco.Pms.Services.Service.ServiceInterfaces
|
||||
public interface IOrganizationService
|
||||
{
|
||||
#region =================================================================== Get Functions ===================================================================
|
||||
Task<ApiResponse<object>> GetOrganizarionListAsync(string? searchString, double? sprid, bool active, int pageNumber, int pageSize, Employee loggedInEmployee, Guid tenantId, Guid loggedOrganizationId);
|
||||
Task<ApiResponse<object>> GetOrganizarionListAsync(string? searchString, long? sprid, bool active, int pageNumber, int pageSize, Employee loggedInEmployee, Guid tenantId, Guid loggedOrganizationId);
|
||||
Task<ApiResponse<object>> GetOrganizationDetailsAsync(Guid id, Employee loggedInEmployee, Guid tenantId, Guid loggedOrganizationId);
|
||||
Task<ApiResponse<object>> GetOrganizationHierarchyListAsync(Guid employeeId, Employee loggedInEmployee, Guid tenantId, Guid loggedOrganizationId);
|
||||
#endregion
|
||||
|
||||
@ -111,7 +111,7 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
// Get last SPRID and increment for new organization
|
||||
var lastOrganization = await _context.Organizations.OrderByDescending(sp => sp.SPRID).FirstOrDefaultAsync();
|
||||
double lastSPRID = lastOrganization?.SPRID ?? 5400;
|
||||
long lastSPRID = lastOrganization?.SPRID ?? 5400;
|
||||
|
||||
// Map DTO to entity and set defaults
|
||||
Organization organization = new Organization
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user