diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index d9a5653..1d13e1d 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -33,6 +33,8 @@ namespace Marco.Pms.DataAccess.Data public DbSet RefreshTokens { get; set; } public DbSet Tenants { get; set; } public DbSet ApplicationUsers { get; set; } + public DbSet ServicesMasters { get; set; } + public DbSet ActivityGroupMasters { get; set; } public DbSet ActivityMasters { get; set; } public DbSet Projects { get; set; } public DbSet ProjectAllocations { get; set; } @@ -363,7 +365,265 @@ namespace Marco.Pms.DataAccess.Data TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") } ); - + modelBuilder.Entity().HasData( + new ServicesMaster + { + Id = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Name = "Civil", + Description = "Construction Civil service involves planning, designing, and overseeing infrastructure and building projects", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ServicesMaster + { + Id = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + Name = "Plumbing", + Description = "Plumbing service involves installing, maintaining, and repairing systems for water supply, drainage, and sewage in residential, commercial, and industrial buildings", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ServicesMaster + { + Id = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + Name = "Electric", + Description = "Electric service involves the installation, maintenance, and repair of electrical systems, including wiring, lighting, and power distribution in buildings and infrastructure", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ServicesMaster + { + Id = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Name = "Fire fighting", + Description = "Fire fighting service involves installing and maintaining systems like sprinklers, hydrants, and alarms to detect, control, and extinguish fires in buildings and facilities.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ServicesMaster + { + Id = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Name = "HVAC", + Description = "HVAC (Heating, Ventilation, and Air Conditioning) service involves the installation, maintenance, and repair of systems that control indoor climate, air quality, and thermal comfort in buildings.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ServicesMaster + { + Id = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Name = "Interior infrastructure", + Description = "Interior infrastructure (Interior Infra) service involves the construction and installation of essential internal structural elements like partitions, ceilings, flooring, and utility layouts to prepare spaces for interior design and functional use.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + } + ); + modelBuilder.Entity().HasData( + new ActivityGroupMaster + { + Id = new Guid("6f048b41-f909-41dd-af5f-02369ca80639"), + ServiceId = Guid.Parse("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Name = "Site Preparation", + Description = "Site Preparation involves clearing, leveling, and preparing the land for construction by removing obstacles, performing excavation, and conducting soil tests.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("1d29b7d1-ffdc-486d-ac7b-ee2661ae9979"), + ServiceId = Guid.Parse("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Name = "Foundation Work", + Description = "Foundation Work involves excavating, reinforcing, and casting the base structure that supports the entire building load, including footings and plinth beams.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("3a712ddb-8927-4d58-8b24-83290e6ba8d1"), + ServiceId = Guid.Parse("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Name = "Sub-Structure Work", + Description = "Sub-Structure Work involves constructing the portion of the building below ground level, including plinth beams, basement walls, and backfilling, to support the superstructure.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("47fa23fb-0e1c-459e-9cc9-9136c61effbd"), + ServiceId = Guid.Parse("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Name = "Super-Structure Work", + Description = "Super-Structure Work involves constructing the part of the building above ground level, including columns, beams, slabs, and walls, forming the main structural framework.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("7613959e-5718-4e46-926b-efa45722c844"), + ServiceId = Guid.Parse("fa208600-b761-480d-95ad-98cad2e61c9b"), + Name = "Water Supply System", + Description = "Water Supply System involves installing pipelines, pumps, tanks, and fittings to ensure the reliable distribution of clean water throughout a building or facility.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("ba4ada9c-ed35-4d5e-bc9f-216f32612c85"), + ServiceId = Guid.Parse("fa208600-b761-480d-95ad-98cad2e61c9b"), + Name = "Drainage & Wastewater System", + Description = "Drainage & Wastewater System involves installing pipes, traps, and chambers to safely collect and dispose of wastewater and sewage from a building to the municipal or septic system.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("44326c01-f69e-430c-a403-d5bf3dcc35d5"), + ServiceId = Guid.Parse("fa208600-b761-480d-95ad-98cad2e61c9b"), + Name = "Rainwater Harvesting", + Description = "Rainwater Harvesting involves collecting, channeling, and storing rainwater from rooftops or surfaces for reuse or groundwater recharge.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("3ef85f9f-e23e-4e6f-9cb7-40ec70a184dd"), + ServiceId = Guid.Parse("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + Name = "Conduiting & Cabling", + Description = "Conduiting & Cabling involves laying electrical conduits and pulling cables to safely route and protect electrical wiring throughout a building.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("a71182a5-0579-4624-b252-4cae2ea11948"), + ServiceId = Guid.Parse("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + Name = "Wiring Installation", + Description = "Wiring Installation involves connecting electrical wires from distribution boards to switches, sockets, and fixtures to provide power and lighting within a building.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("b5e2291f-3569-45e5-9c30-ef33ad0abbf1"), + ServiceId = Guid.Parse("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + Name = "Lighting System", + Description = "Lighting System involves installing and connecting various lighting fixtures, controls, and fittings to ensure proper illumination for indoor and outdoor areas.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("56584b0f-b2a5-4a5e-afea-590516473bcd"), + ServiceId = Guid.Parse("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Name = "Sprinkler System", + Description = "Sprinkler System involves installing a network of pipes and sprinkler heads designed to automatically discharge water to suppress or extinguish fires.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("78a12040-4ab6-493a-b199-ee636f45f77f"), + ServiceId = Guid.Parse("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Name = "Fire Hydrant System", + Description = "Fire Hydrant System involves installing external and internal hydrants, piping, and valves to provide high-pressure water access for manual firefighting during emergencies.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("fbb04bec-53a7-4f86-8536-34c4b5c691a2"), + ServiceId = Guid.Parse("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Name = "Liaisoning", + Description = "Liaisoning – Fire Fighting involves coordinating with fire authorities to obtain necessary approvals and no-objection certificates (NOCs) for fire safety systems, ensuring compliance with local fire safety regulations.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("6eedb9f1-22e9-4d93-b770-593125085465"), + ServiceId = Guid.Parse("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Name = "Public Address (PA) System", + Description = "Public Address (PA) System involves installing speakers, microphones, amplifiers, and control units to broadcast announcements, alerts, and emergency messages throughout a building or facility.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("97c6f9f5-cd4d-4830-ba14-a81f6ee0d1e2"), + ServiceId = Guid.Parse("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Name = "Detection and Alarm System", + Description = "Detection and Alarm System involves installing smoke detectors, heat sensors, and fire alarm panels to automatically detect fire or smoke and alert occupants through audible and visual alarms.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("cdea8e5f-8b78-4f7e-ab65-bd6b38d81af2"), + ServiceId = Guid.Parse("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Name = "HVAC System Design & Planning", + Description = "HVAC System Design & Planning involves calculating heating and cooling loads, selecting appropriate equipment, and designing duct and piping layouts to ensure efficient climate control and air quality.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("1805e22d-4220-45cc-8f39-35194c2499a5"), + ServiceId = Guid.Parse("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Name = "Ducting Work", + Description = "Ducting Work involves fabricating, installing, and insulating ducts to distribute conditioned air throughout the building as part of the HVAC system.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("69819ea6-5550-4325-9097-c52d95db0822"), + ServiceId = Guid.Parse("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Name = "Equipment Installation", + Description = "Equipment Installation involves setting up HVAC units such as AHUs, FCUs, chillers, and compressors to enable heating, cooling, and ventilation operations in the building.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("fe613446-c399-4a5c-8205-fd3652231f57"), + ServiceId = Guid.Parse("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Name = "Ventilation System", + Description = "Ventilation System involves installing exhausts, fresh air units, and ductwork to ensure proper air circulation, removal of stale air, and maintenance of indoor air quality.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("0398ba10-f814-404a-a7a2-3bac0f61a9a5"), + ServiceId = Guid.Parse("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Name = "Partition Work", + Description = "Partition Work involves constructing internal dividing walls using materials like gypsum, glass, or wood to create separate rooms or functional spaces within a building.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("9efaa80a-f115-4e78-866a-5e192faa1024"), + ServiceId = Guid.Parse("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Name = "False Ceiling Work", + Description = "False Ceiling Work involves installing suspended ceilings made of materials like gypsum, metal, or POP to conceal services, improve aesthetics, and enhance acoustic and thermal performance.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("c0a9e90c-4c74-417d-b36e-6e63eca16463"), + ServiceId = Guid.Parse("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Name = "Door & Window Installation", + Description = "Door & Window Installation involves fitting and fixing doors and windows made of wood, aluminum, uPVC, or glass to provide access, ventilation, and natural light within the building.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new ActivityGroupMaster + { + Id = new Guid("a27d502b-20ea-4926-b294-3db7110f94e5"), + ServiceId = Guid.Parse("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Name = "Data & Communication Cabling", + Description = "Data & Communication Cabling involves laying structured cables for internet, telephone, and networking systems to ensure reliable communication and connectivity throughout the building.", + IsSystem = true, + TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26") + } + ); } private static void ManageApplicationStructure(ModelBuilder modelBuilder) diff --git a/Marco.Pms.DataAccess/Migrations/20250625065922_Added_Service_And_ActivityGroup_Master_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250625065922_Added_Service_And_ActivityGroup_Master_Table.Designer.cs new file mode 100644 index 0000000..e2063c7 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250625065922_Added_Service_And_ActivityGroup_Master_Table.Designer.cs @@ -0,0 +1,3768 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250625065922_Added_Service_And_ActivityGroup_Master_Table")] + partial class Added_Service_And_ActivityGroup_Master_Table + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ApprovedById") + .HasColumnType("char(36)"); + + b.Property("ApprovedDate") + .HasColumnType("datetime(6)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ParentTaskId") + .HasColumnType("char(36)"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedById") + .HasColumnType("char(36)"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("ReportedTask") + .HasColumnType("double"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.Property("WorkStatusId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApprovedById"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("ReportedById"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.HasIndex("WorkStatusId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("ReferenceId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TaskAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.MPINDetails", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("MPIN") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MPINToken") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeStamp") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("MPINDetails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.OTPDetails", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ExpriesInSec") + .HasColumnType("int"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("OTP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeStamp") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("OTPDetails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByID"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Team Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("ccb0589f-712b-43de-92ed-5b6088e7dc4e"), + Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Self Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailDetails", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("MailListId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("Recipient") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Schedule") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("MailListId"); + + b.ToTable("MailDetails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmailId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeStamp") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("MailLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailingList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Keywords") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("MailingList"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityGroupMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ServiceId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityGroupMasters"); + + b.HasData( + new + { + Id = new Guid("6f048b41-f909-41dd-af5f-02369ca80639"), + Description = "Site Preparation involves clearing, leveling, and preparing the land for construction by removing obstacles, performing excavation, and conducting soil tests.", + IsActive = true, + IsSystem = true, + Name = "Site Preparation", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("1d29b7d1-ffdc-486d-ac7b-ee2661ae9979"), + Description = "Foundation Work involves excavating, reinforcing, and casting the base structure that supports the entire building load, including footings and plinth beams.", + IsActive = true, + IsSystem = true, + Name = "Foundation Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("3a712ddb-8927-4d58-8b24-83290e6ba8d1"), + Description = "Sub-Structure Work involves constructing the portion of the building below ground level, including plinth beams, basement walls, and backfilling, to support the superstructure.", + IsActive = true, + IsSystem = true, + Name = "Sub-Structure Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("47fa23fb-0e1c-459e-9cc9-9136c61effbd"), + Description = "Super-Structure Work involves constructing the part of the building above ground level, including columns, beams, slabs, and walls, forming the main structural framework.", + IsActive = true, + IsSystem = true, + Name = "Super-Structure Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7613959e-5718-4e46-926b-efa45722c844"), + Description = "Water Supply System involves installing pipelines, pumps, tanks, and fittings to ensure the reliable distribution of clean water throughout a building or facility.", + IsActive = true, + IsSystem = true, + Name = "Water Supply System", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ba4ada9c-ed35-4d5e-bc9f-216f32612c85"), + Description = "Drainage & Wastewater System involves installing pipes, traps, and chambers to safely collect and dispose of wastewater and sewage from a building to the municipal or septic system.", + IsActive = true, + IsSystem = true, + Name = "Drainage & Wastewater System", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44326c01-f69e-430c-a403-d5bf3dcc35d5"), + Description = "Rainwater Harvesting involves collecting, channeling, and storing rainwater from rooftops or surfaces for reuse or groundwater recharge.", + IsActive = true, + IsSystem = true, + Name = "Rainwater Harvesting", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("3ef85f9f-e23e-4e6f-9cb7-40ec70a184dd"), + Description = "Conduiting & Cabling involves laying electrical conduits and pulling cables to safely route and protect electrical wiring throughout a building.", + IsActive = true, + IsSystem = true, + Name = "Conduiting & Cabling", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a71182a5-0579-4624-b252-4cae2ea11948"), + Description = "Wiring Installation involves connecting electrical wires from distribution boards to switches, sockets, and fixtures to provide power and lighting within a building.", + IsActive = true, + IsSystem = true, + Name = "Wiring Installation", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("b5e2291f-3569-45e5-9c30-ef33ad0abbf1"), + Description = "Lighting System involves installing and connecting various lighting fixtures, controls, and fittings to ensure proper illumination for indoor and outdoor areas.", + IsActive = true, + IsSystem = true, + Name = "Lighting System", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("56584b0f-b2a5-4a5e-afea-590516473bcd"), + Description = "Sprinkler System involves installing a network of pipes and sprinkler heads designed to automatically discharge water to suppress or extinguish fires.", + IsActive = true, + IsSystem = true, + Name = "Sprinkler System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("78a12040-4ab6-493a-b199-ee636f45f77f"), + Description = "Fire Hydrant System involves installing external and internal hydrants, piping, and valves to provide high-pressure water access for manual firefighting during emergencies.", + IsActive = true, + IsSystem = true, + Name = "Fire Hydrant System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fbb04bec-53a7-4f86-8536-34c4b5c691a2"), + Description = "Liaisoning – Fire Fighting involves coordinating with fire authorities to obtain necessary approvals and no-objection certificates (NOCs) for fire safety systems, ensuring compliance with local fire safety regulations.", + IsActive = true, + IsSystem = true, + Name = "Liaisoning", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6eedb9f1-22e9-4d93-b770-593125085465"), + Description = "Public Address (PA) System involves installing speakers, microphones, amplifiers, and control units to broadcast announcements, alerts, and emergency messages throughout a building or facility.", + IsActive = true, + IsSystem = true, + Name = "Public Address (PA) System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("97c6f9f5-cd4d-4830-ba14-a81f6ee0d1e2"), + Description = "Detection and Alarm System involves installing smoke detectors, heat sensors, and fire alarm panels to automatically detect fire or smoke and alert occupants through audible and visual alarms.", + IsActive = true, + IsSystem = true, + Name = "Detection and Alarm System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("cdea8e5f-8b78-4f7e-ab65-bd6b38d81af2"), + Description = "HVAC System Design & Planning involves calculating heating and cooling loads, selecting appropriate equipment, and designing duct and piping layouts to ensure efficient climate control and air quality.", + IsActive = true, + IsSystem = true, + Name = "HVAC System Design & Planning", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("1805e22d-4220-45cc-8f39-35194c2499a5"), + Description = "Ducting Work involves fabricating, installing, and insulating ducts to distribute conditioned air throughout the building as part of the HVAC system.", + IsActive = true, + IsSystem = true, + Name = "Ducting Work", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("69819ea6-5550-4325-9097-c52d95db0822"), + Description = "Equipment Installation involves setting up HVAC units such as AHUs, FCUs, chillers, and compressors to enable heating, cooling, and ventilation operations in the building.", + IsActive = true, + IsSystem = true, + Name = "Equipment Installation", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fe613446-c399-4a5c-8205-fd3652231f57"), + Description = "Ventilation System involves installing exhausts, fresh air units, and ductwork to ensure proper air circulation, removal of stale air, and maintenance of indoor air quality.", + IsActive = true, + IsSystem = true, + Name = "Ventilation System", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0398ba10-f814-404a-a7a2-3bac0f61a9a5"), + Description = "Partition Work involves constructing internal dividing walls using materials like gypsum, glass, or wood to create separate rooms or functional spaces within a building.", + IsActive = true, + IsSystem = true, + Name = "Partition Work", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9efaa80a-f115-4e78-866a-5e192faa1024"), + Description = "False Ceiling Work involves installing suspended ceilings made of materials like gypsum, metal, or POP to conceal services, improve aesthetics, and enhance acoustic and thermal performance.", + IsActive = true, + IsSystem = true, + Name = "False Ceiling Work", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("c0a9e90c-4c74-417d-b36e-6e63eca16463"), + Description = "Door & Window Installation involves fitting and fixing doors and windows made of wood, aluminum, uPVC, or glass to provide access, ventilation, and natural light within the building.", + IsActive = true, + IsSystem = true, + Name = "Door & Window Installation", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a27d502b-20ea-4926-b294-3db7110f94e5"), + Description = "Data & Communication Cabling involves laying structured cables for internet, telephone, and networking systems to ensure reliable communication and connectivity throughout the building.", + IsActive = true, + IsSystem = true, + Name = "Data & Communication Cabling", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActitvityGroupId") + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ServiceId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ServicesMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ServicesMasters"); + + b.HasData( + new + { + Id = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Description = "Construction Civil service involves planning, designing, and overseeing infrastructure and building projects", + IsActive = true, + IsSystem = true, + Name = "Civil", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + Description = "Plumbing service involves installing, maintaining, and repairing systems for water supply, drainage, and sewage in residential, commercial, and industrial buildings", + IsActive = true, + IsSystem = true, + Name = "Plumbing", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + Description = "Electric service involves the installation, maintenance, and repair of electrical systems, including wiring, lighting, and power distribution in buildings and infrastructure", + IsActive = true, + IsSystem = true, + Name = "Electric", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Description = "Fire fighting service involves installing and maintaining systems like sprinklers, hydrants, and alarms to detect, control, and extinguish fires in buildings and facilities.", + IsActive = true, + IsSystem = true, + Name = "Fire fighting", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Description = "HVAC (Heating, Ventilation, and Air Conditioning) service involves the installation, maintenance, and repair of systems that control indoor climate, air quality, and thermal comfort in buildings.", + IsActive = true, + IsSystem = true, + Name = "HVAC", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Description = "Interior infrastructure (Interior Infra) service involves the construction and installation of essential internal structural elements like partitions, ceilings, flooring, and utility layouts to prepare spaces for interior design and functional use.", + IsActive = true, + IsSystem = true, + Name = "Interior infrastructure", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "In Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkStatusMasters"); + + b.HasData( + new + { + Id = new Guid("030bb085-e230-4370-aec7-9a74d652864e"), + Description = "Confirm the tasks are actually finished as reported", + IsSystem = true, + Name = "Approve", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("2a1a5b96-cf93-4111-b4b1-76c19d6333b4"), + Description = "Not all tasks are actually finished as reported", + IsSystem = true, + Name = "Partially Approve", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("00a062e6-62e6-42c5-b6b1-024328651b72"), + Description = "Tasks are not finished as reported or have any issues in al the tasks", + IsSystem = true, + Name = "NCR", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("ShortName") + .HasColumnType("longtext"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ParentTaskId") + .HasColumnType("char(36)"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "ApprovedBy") + .WithMany() + .HasForeignKey("ApprovedById"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "ReportedBy") + .WithMany() + .HasForeignKey("ReportedById"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.WorkStatusMaster", "WorkStatus") + .WithMany() + .HasForeignKey("WorkStatusId"); + + b.Navigation("ApprovedBy"); + + b.Navigation("Employee"); + + b.Navigation("ReportedBy"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + + b.Navigation("WorkStatus"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Document"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.MPINDetails", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.OTPDetails", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Roles.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Roles.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailDetails", b => + { + b.HasOne("Marco.Pms.Model.Mail.MailingList", "MailBody") + .WithMany() + .HasForeignKey("MailListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MailBody"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityGroupMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ServicesMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkStatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250625065922_Added_Service_And_ActivityGroup_Master_Table.cs b/Marco.Pms.DataAccess/Migrations/20250625065922_Added_Service_And_ActivityGroup_Master_Table.cs new file mode 100644 index 0000000..4193ed1 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250625065922_Added_Service_And_ActivityGroup_Master_Table.cs @@ -0,0 +1,209 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_Service_And_ActivityGroup_Master_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "UnitOfMeasurement", + keyValue: null, + column: "UnitOfMeasurement", + value: ""); + + migrationBuilder.AlterColumn( + name: "UnitOfMeasurement", + table: "ActivityMasters", + type: "longtext", + nullable: false, + oldClrType: typeof(string), + oldType: "longtext", + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "ActivityName", + keyValue: null, + column: "ActivityName", + value: ""); + + migrationBuilder.AlterColumn( + name: "ActivityName", + table: "ActivityMasters", + type: "longtext", + nullable: false, + oldClrType: typeof(string), + oldType: "longtext", + oldNullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "ActitvityGroupId", + table: "ActivityMasters", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddColumn( + name: "ServiceId", + table: "ActivityMasters", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.CreateTable( + name: "ActivityGroupMasters", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ServiceId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsSystem = table.Column(type: "tinyint(1)", nullable: false), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ActivityGroupMasters", x => x.Id); + table.ForeignKey( + name: "FK_ActivityGroupMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ServicesMasters", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + IsSystem = table.Column(type: "tinyint(1)", nullable: false), + IsActive = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_ServicesMasters", x => x.Id); + table.ForeignKey( + name: "FK_ServicesMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.InsertData( + table: "ActivityGroupMasters", + columns: new[] { "Id", "Description", "IsActive", "IsSystem", "Name", "ServiceId", "TenantId" }, + values: new object[,] + { + { new Guid("0398ba10-f814-404a-a7a2-3bac0f61a9a5"), "Partition Work involves constructing internal dividing walls using materials like gypsum, glass, or wood to create separate rooms or functional spaces within a building.", true, true, "Partition Work", new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("1805e22d-4220-45cc-8f39-35194c2499a5"), "Ducting Work involves fabricating, installing, and insulating ducts to distribute conditioned air throughout the building as part of the HVAC system.", true, true, "Ducting Work", new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("1d29b7d1-ffdc-486d-ac7b-ee2661ae9979"), "Foundation Work involves excavating, reinforcing, and casting the base structure that supports the entire building load, including footings and plinth beams.", true, true, "Foundation Work", new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("3a712ddb-8927-4d58-8b24-83290e6ba8d1"), "Sub-Structure Work involves constructing the portion of the building below ground level, including plinth beams, basement walls, and backfilling, to support the superstructure.", true, true, "Sub-Structure Work", new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("3ef85f9f-e23e-4e6f-9cb7-40ec70a184dd"), "Conduiting & Cabling involves laying electrical conduits and pulling cables to safely route and protect electrical wiring throughout a building.", true, true, "Conduiting & Cabling", new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("44326c01-f69e-430c-a403-d5bf3dcc35d5"), "Rainwater Harvesting involves collecting, channeling, and storing rainwater from rooftops or surfaces for reuse or groundwater recharge.", true, true, "Rainwater Harvesting", new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("47fa23fb-0e1c-459e-9cc9-9136c61effbd"), "Super-Structure Work involves constructing the part of the building above ground level, including columns, beams, slabs, and walls, forming the main structural framework.", true, true, "Super-Structure Work", new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("56584b0f-b2a5-4a5e-afea-590516473bcd"), "Sprinkler System involves installing a network of pipes and sprinkler heads designed to automatically discharge water to suppress or extinguish fires.", true, true, "Sprinkler System", new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("69819ea6-5550-4325-9097-c52d95db0822"), "Equipment Installation involves setting up HVAC units such as AHUs, FCUs, chillers, and compressors to enable heating, cooling, and ventilation operations in the building.", true, true, "Equipment Installation", new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("6eedb9f1-22e9-4d93-b770-593125085465"), "Public Address (PA) System involves installing speakers, microphones, amplifiers, and control units to broadcast announcements, alerts, and emergency messages throughout a building or facility.", true, true, "Public Address (PA) System", new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("6f048b41-f909-41dd-af5f-02369ca80639"), "Site Preparation involves clearing, leveling, and preparing the land for construction by removing obstacles, performing excavation, and conducting soil tests.", true, true, "Site Preparation", new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("7613959e-5718-4e46-926b-efa45722c844"), "Water Supply System involves installing pipelines, pumps, tanks, and fittings to ensure the reliable distribution of clean water throughout a building or facility.", true, true, "Water Supply System", new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("78a12040-4ab6-493a-b199-ee636f45f77f"), "Fire Hydrant System involves installing external and internal hydrants, piping, and valves to provide high-pressure water access for manual firefighting during emergencies.", true, true, "Fire Hydrant System", new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("97c6f9f5-cd4d-4830-ba14-a81f6ee0d1e2"), "Detection and Alarm System involves installing smoke detectors, heat sensors, and fire alarm panels to automatically detect fire or smoke and alert occupants through audible and visual alarms.", true, true, "Detection and Alarm System", new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("9efaa80a-f115-4e78-866a-5e192faa1024"), "False Ceiling Work involves installing suspended ceilings made of materials like gypsum, metal, or POP to conceal services, improve aesthetics, and enhance acoustic and thermal performance.", true, true, "False Ceiling Work", new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("a27d502b-20ea-4926-b294-3db7110f94e5"), "Data & Communication Cabling involves laying structured cables for internet, telephone, and networking systems to ensure reliable communication and connectivity throughout the building.", true, true, "Data & Communication Cabling", new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("a71182a5-0579-4624-b252-4cae2ea11948"), "Wiring Installation involves connecting electrical wires from distribution boards to switches, sockets, and fixtures to provide power and lighting within a building.", true, true, "Wiring Installation", new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("b5e2291f-3569-45e5-9c30-ef33ad0abbf1"), "Lighting System involves installing and connecting various lighting fixtures, controls, and fittings to ensure proper illumination for indoor and outdoor areas.", true, true, "Lighting System", new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("ba4ada9c-ed35-4d5e-bc9f-216f32612c85"), "Drainage & Wastewater System involves installing pipes, traps, and chambers to safely collect and dispose of wastewater and sewage from a building to the municipal or septic system.", true, true, "Drainage & Wastewater System", new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("c0a9e90c-4c74-417d-b36e-6e63eca16463"), "Door & Window Installation involves fitting and fixing doors and windows made of wood, aluminum, uPVC, or glass to provide access, ventilation, and natural light within the building.", true, true, "Door & Window Installation", new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("cdea8e5f-8b78-4f7e-ab65-bd6b38d81af2"), "HVAC System Design & Planning involves calculating heating and cooling loads, selecting appropriate equipment, and designing duct and piping layouts to ensure efficient climate control and air quality.", true, true, "HVAC System Design & Planning", new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("fbb04bec-53a7-4f86-8536-34c4b5c691a2"), "Liaisoning – Fire Fighting involves coordinating with fire authorities to obtain necessary approvals and no-objection certificates (NOCs) for fire safety systems, ensuring compliance with local fire safety regulations.", true, true, "Liaisoning", new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("fe613446-c399-4a5c-8205-fd3652231f57"), "Ventilation System involves installing exhausts, fresh air units, and ductwork to ensure proper air circulation, removal of stale air, and maintenance of indoor air quality.", true, true, "Ventilation System", new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") } + }); + + migrationBuilder.InsertData( + table: "ServicesMasters", + columns: new[] { "Id", "Description", "IsActive", "IsSystem", "Name", "TenantId" }, + values: new object[,] + { + { new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), "Construction Civil service involves planning, designing, and overseeing infrastructure and building projects", true, true, "Civil", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), "Interior infrastructure (Interior Infra) service involves the construction and installation of essential internal structural elements like partitions, ceilings, flooring, and utility layouts to prepare spaces for interior design and functional use.", true, true, "Interior infrastructure", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), "Fire fighting service involves installing and maintaining systems like sprinklers, hydrants, and alarms to detect, control, and extinguish fires in buildings and facilities.", true, true, "Fire fighting", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), "HVAC (Heating, Ventilation, and Air Conditioning) service involves the installation, maintenance, and repair of systems that control indoor climate, air quality, and thermal comfort in buildings.", true, true, "HVAC", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), "Electric service involves the installation, maintenance, and repair of electrical systems, including wiring, lighting, and power distribution in buildings and infrastructure", true, true, "Electric", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }, + { new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), "Plumbing service involves installing, maintaining, and repairing systems for water supply, drainage, and sewage in residential, commercial, and industrial buildings", true, true, "Plumbing", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") } + }); + + migrationBuilder.CreateIndex( + name: "IX_ActivityGroupMasters_TenantId", + table: "ActivityGroupMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ServicesMasters_TenantId", + table: "ServicesMasters", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ActivityGroupMasters"); + + migrationBuilder.DropTable( + name: "ServicesMasters"); + + migrationBuilder.DropColumn( + name: "ActitvityGroupId", + table: "ActivityMasters"); + + migrationBuilder.DropColumn( + name: "ServiceId", + table: "ActivityMasters"); + + migrationBuilder.AlterColumn( + name: "UnitOfMeasurement", + table: "ActivityMasters", + type: "longtext", + nullable: true, + oldClrType: typeof(string), + oldType: "longtext") + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "ActivityName", + table: "ActivityMasters", + type: "longtext", + nullable: true, + oldClrType: typeof(string), + oldType: "longtext") + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250625075520_Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250625075520_Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table.Designer.cs new file mode 100644 index 0000000..05d589a --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250625075520_Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table.Designer.cs @@ -0,0 +1,3794 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250625075520_Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table")] + partial class Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ApprovedById") + .HasColumnType("char(36)"); + + b.Property("ApprovedDate") + .HasColumnType("datetime(6)"); + + b.Property("AssignedBy") + .HasColumnType("char(36)"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ParentTaskId") + .HasColumnType("char(36)"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedById") + .HasColumnType("char(36)"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("ReportedTask") + .HasColumnType("double"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkItemId") + .HasColumnType("char(36)"); + + b.Property("WorkStatusId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApprovedById"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("ReportedById"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.HasIndex("WorkStatusId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("ReferenceId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TaskAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentedBy"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("char(36)"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("char(36)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DocumentId") + .HasColumnType("char(36)"); + + b.Property("EmployeeID") + .HasColumnType("char(36)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UpdatedBy") + .HasColumnType("char(36)"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("DocumentId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.MPINDetails", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("MPIN") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MPINToken") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeStamp") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("MPINDetails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.OTPDetails", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ExpriesInSec") + .HasColumnType("int"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("OTP") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeStamp") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("OTPDetails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedByID") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedByID"); + + b.HasIndex("TenantId"); + + b.ToTable("Buckets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Address") + .HasColumnType("longtext"); + + b.Property("ContactCategoryId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Organization") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactCategoryId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactCategoryMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsEmails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Note") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("CreatedById"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactNotes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("IsPrimary") + .HasColumnType("tinyint(1)"); + + b.Property("Label") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("ContactsPhones"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactProjectMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactId") + .HasColumnType("char(36)"); + + b.Property("ContactTagId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.HasIndex("ContactTagId"); + + b.ToTable("ContactTagMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ContactTagMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("RefereanceId") + .HasColumnType("char(36)"); + + b.Property("UpdateAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedById") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UpdatedById"); + + b.ToTable("DirectoryUpdateLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BucketId") + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BucketId"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeBucketMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Base64Data") + .HasColumnType("longtext"); + + b.Property("BatchId") + .HasColumnType("char(36)"); + + b.Property("ContentType") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("S3Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("ThumbS3Key") + .HasColumnType("longtext"); + + b.Property("UploadedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Documents"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .HasColumnType("longtext"); + + b.Property("FirstName") + .HasColumnType("longtext"); + + b.Property("Gender") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PermanentAddress") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityCheckList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsChecked") + .HasColumnType("tinyint(1)"); + + b.Property("IsMandatory") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("ActivityCheckLists"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.CheckListMappings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CheckListId") + .HasColumnType("char(36)"); + + b.Property("TaskAllocationId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("CheckListMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "Access all information related to the project.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "Potentially edit the project name, description, start/end dates, or status.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "The \"Manage Team\" feature allows authorized users to organize project personnel by adding, removing, and assigning employee to projects.", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "Grants a user comprehensive read-only access to all details associated with tasks within a project. This includes task descriptions, statuses, assignees, due dates, dependencies, progress, history, and any related attachments or discussions.", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "This allows them to create new tasks, modify existing task attributes (description, status, assignee, due date, etc.),", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Add/Edit Task" + }, + new + { + Id = new Guid("6a32379b-8b3f-49a6-8c48-4b7ac1b55dc2"), + Description = "Grants a user the ability to designate team members responsible for specific tasks and to update the completion status or provide progress updates for those tasks", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Assign/Report Progress" + }, + new + { + Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), + Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Add/Edit Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system.", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Roles" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Team Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "Grants a user the authority to approve requests from employees to adjust or correct their recorded attendance. This typically involves reviewing the reason for the regularization, verifying any supporting documentation, and then officially accepting the changes to the employee's attendance records", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("ccb0589f-712b-43de-92ed-5b6088e7dc4e"), + Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager.", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Self Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), + Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Admin" + }, + new + { + Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), + Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory Manager" + }, + new + { + Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), + Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Directory User" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactName") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("DomainName") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("IndustryId"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = new Guid("b3466e83-7e11-464c-b93a-daf047838b26"), + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + OragnizationSize = "100-200" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CommentId") + .HasColumnType("char(36)"); + + b.Property("FileId") + .HasColumnType("char(36)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("CommentId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketAttachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AuthorId") + .HasColumnType("char(36)"); + + b.Property("MessageText") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ParentMessageId") + .HasColumnType("char(36)"); + + b.Property("SentAt") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("TicketComments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatedById") + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LinkedActivityId") + .HasColumnType("char(36)"); + + b.Property("LinkedProjectId") + .HasColumnType("char(36)"); + + b.Property("PriorityId") + .HasColumnType("char(36)"); + + b.Property("StatusId") + .HasColumnType("char(36)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TypeId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("PriorityId"); + + b.HasIndex("StatusId"); + + b.HasIndex("TenantId"); + + b.HasIndex("TypeId"); + + b.ToTable("Tickets"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("TagId") + .HasColumnType("char(36)"); + + b.Property("TicketId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.HasIndex("TicketId"); + + b.ToTable("TicketTags"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTypeMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTypeMasters"); + + b.HasData( + new + { + Id = new Guid("c74e5480-2b71-483c-8f4a-1a9c69c32603"), + Description = "An identified problem that affects the performance, reliability, or standards of a product or service", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("d1f55eab-9898-4e46-9f03-b263e33e5d38"), + Description = "A support service that assists users with technical issues, requests, or inquiries.", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailDetails", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("MailListId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("Recipient") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Schedule") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("MailListId"); + + b.ToTable("MailDetails"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmailId") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("TimeStamp") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("MailLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailingList", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Keywords") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("MailingList"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityGroupMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ServiceId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityGroupMasters"); + + b.HasData( + new + { + Id = new Guid("6f048b41-f909-41dd-af5f-02369ca80639"), + Description = "Site Preparation involves clearing, leveling, and preparing the land for construction by removing obstacles, performing excavation, and conducting soil tests.", + IsActive = true, + IsSystem = true, + Name = "Site Preparation", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("1d29b7d1-ffdc-486d-ac7b-ee2661ae9979"), + Description = "Foundation Work involves excavating, reinforcing, and casting the base structure that supports the entire building load, including footings and plinth beams.", + IsActive = true, + IsSystem = true, + Name = "Foundation Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("3a712ddb-8927-4d58-8b24-83290e6ba8d1"), + Description = "Sub-Structure Work involves constructing the portion of the building below ground level, including plinth beams, basement walls, and backfilling, to support the superstructure.", + IsActive = true, + IsSystem = true, + Name = "Sub-Structure Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("47fa23fb-0e1c-459e-9cc9-9136c61effbd"), + Description = "Super-Structure Work involves constructing the part of the building above ground level, including columns, beams, slabs, and walls, forming the main structural framework.", + IsActive = true, + IsSystem = true, + Name = "Super-Structure Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7613959e-5718-4e46-926b-efa45722c844"), + Description = "Water Supply System involves installing pipelines, pumps, tanks, and fittings to ensure the reliable distribution of clean water throughout a building or facility.", + IsActive = true, + IsSystem = true, + Name = "Water Supply System", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ba4ada9c-ed35-4d5e-bc9f-216f32612c85"), + Description = "Drainage & Wastewater System involves installing pipes, traps, and chambers to safely collect and dispose of wastewater and sewage from a building to the municipal or septic system.", + IsActive = true, + IsSystem = true, + Name = "Drainage & Wastewater System", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44326c01-f69e-430c-a403-d5bf3dcc35d5"), + Description = "Rainwater Harvesting involves collecting, channeling, and storing rainwater from rooftops or surfaces for reuse or groundwater recharge.", + IsActive = true, + IsSystem = true, + Name = "Rainwater Harvesting", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("3ef85f9f-e23e-4e6f-9cb7-40ec70a184dd"), + Description = "Conduiting & Cabling involves laying electrical conduits and pulling cables to safely route and protect electrical wiring throughout a building.", + IsActive = true, + IsSystem = true, + Name = "Conduiting & Cabling", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a71182a5-0579-4624-b252-4cae2ea11948"), + Description = "Wiring Installation involves connecting electrical wires from distribution boards to switches, sockets, and fixtures to provide power and lighting within a building.", + IsActive = true, + IsSystem = true, + Name = "Wiring Installation", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("b5e2291f-3569-45e5-9c30-ef33ad0abbf1"), + Description = "Lighting System involves installing and connecting various lighting fixtures, controls, and fittings to ensure proper illumination for indoor and outdoor areas.", + IsActive = true, + IsSystem = true, + Name = "Lighting System", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("56584b0f-b2a5-4a5e-afea-590516473bcd"), + Description = "Sprinkler System involves installing a network of pipes and sprinkler heads designed to automatically discharge water to suppress or extinguish fires.", + IsActive = true, + IsSystem = true, + Name = "Sprinkler System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("78a12040-4ab6-493a-b199-ee636f45f77f"), + Description = "Fire Hydrant System involves installing external and internal hydrants, piping, and valves to provide high-pressure water access for manual firefighting during emergencies.", + IsActive = true, + IsSystem = true, + Name = "Fire Hydrant System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fbb04bec-53a7-4f86-8536-34c4b5c691a2"), + Description = "Liaisoning – Fire Fighting involves coordinating with fire authorities to obtain necessary approvals and no-objection certificates (NOCs) for fire safety systems, ensuring compliance with local fire safety regulations.", + IsActive = true, + IsSystem = true, + Name = "Liaisoning", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6eedb9f1-22e9-4d93-b770-593125085465"), + Description = "Public Address (PA) System involves installing speakers, microphones, amplifiers, and control units to broadcast announcements, alerts, and emergency messages throughout a building or facility.", + IsActive = true, + IsSystem = true, + Name = "Public Address (PA) System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("97c6f9f5-cd4d-4830-ba14-a81f6ee0d1e2"), + Description = "Detection and Alarm System involves installing smoke detectors, heat sensors, and fire alarm panels to automatically detect fire or smoke and alert occupants through audible and visual alarms.", + IsActive = true, + IsSystem = true, + Name = "Detection and Alarm System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("cdea8e5f-8b78-4f7e-ab65-bd6b38d81af2"), + Description = "HVAC System Design & Planning involves calculating heating and cooling loads, selecting appropriate equipment, and designing duct and piping layouts to ensure efficient climate control and air quality.", + IsActive = true, + IsSystem = true, + Name = "HVAC System Design & Planning", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("1805e22d-4220-45cc-8f39-35194c2499a5"), + Description = "Ducting Work involves fabricating, installing, and insulating ducts to distribute conditioned air throughout the building as part of the HVAC system.", + IsActive = true, + IsSystem = true, + Name = "Ducting Work", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("69819ea6-5550-4325-9097-c52d95db0822"), + Description = "Equipment Installation involves setting up HVAC units such as AHUs, FCUs, chillers, and compressors to enable heating, cooling, and ventilation operations in the building.", + IsActive = true, + IsSystem = true, + Name = "Equipment Installation", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fe613446-c399-4a5c-8205-fd3652231f57"), + Description = "Ventilation System involves installing exhausts, fresh air units, and ductwork to ensure proper air circulation, removal of stale air, and maintenance of indoor air quality.", + IsActive = true, + IsSystem = true, + Name = "Ventilation System", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0398ba10-f814-404a-a7a2-3bac0f61a9a5"), + Description = "Partition Work involves constructing internal dividing walls using materials like gypsum, glass, or wood to create separate rooms or functional spaces within a building.", + IsActive = true, + IsSystem = true, + Name = "Partition Work", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9efaa80a-f115-4e78-866a-5e192faa1024"), + Description = "False Ceiling Work involves installing suspended ceilings made of materials like gypsum, metal, or POP to conceal services, improve aesthetics, and enhance acoustic and thermal performance.", + IsActive = true, + IsSystem = true, + Name = "False Ceiling Work", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("c0a9e90c-4c74-417d-b36e-6e63eca16463"), + Description = "Door & Window Installation involves fitting and fixing doors and windows made of wood, aluminum, uPVC, or glass to provide access, ventilation, and natural light within the building.", + IsActive = true, + IsSystem = true, + Name = "Door & Window Installation", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a27d502b-20ea-4926-b294-3db7110f94e5"), + Description = "Data & Communication Cabling involves laying structured cables for internet, telephone, and networking systems to ensure reliable communication and connectivity throughout the building.", + IsActive = true, + IsSystem = true, + Name = "Data & Communication Cabling", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActitvityGroupId") + .HasColumnType("char(36)"); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ServiceId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ActitvityGroupId"); + + b.HasIndex("ServiceId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Name = "Task Management" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Employee Management" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Global Masters" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Managing all directory related rights", + IsActive = true, + ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Name = "Directory Management" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = new Guid("15436ee3-a650-469e-bfc2-59993f7514bb"), + Name = "Information Technology (IT) Services" + }, + new + { + Id = new Guid("0a63e657-2c5f-49b5-854b-42c978293154"), + Name = "Manufacturing & Production" + }, + new + { + Id = new Guid("bdc61e3b-69ea-4394-bab6-079ec135b5bd"), + Name = "Energy & Resources" + }, + new + { + Id = new Guid("5ca200ac-00d7-415e-a410-b948e27ac9d2"), + Name = "Finance & Professional Services" + }, + new + { + Id = new Guid("d5621700-cd87-441f-8cdb-6051ddfc83b4"), + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = new Guid("23608891-657e-40f0-bbd4-2b0a2ec1a76f"), + Name = "Social Services" + }, + new + { + Id = new Guid("a493f4e3-16b1-4411-be3c-6bf2987a3168"), + Name = "Retail & Consumer Services" + }, + new + { + Id = new Guid("e9d8ce92-9371-4ed9-9831-83c07f78edec"), + Name = "Transportation & Logistics" + }, + new + { + Id = new Guid("8a0d6134-2dbe-4e0a-b250-ff34cb7b9df0"), + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ServicesMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ServicesMasters"); + + b.HasData( + new + { + Id = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Description = "Construction Civil service involves planning, designing, and overseeing infrastructure and building projects", + IsActive = true, + IsSystem = true, + Name = "Civil", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + Description = "Plumbing service involves installing, maintaining, and repairing systems for water supply, drainage, and sewage in residential, commercial, and industrial buildings", + IsActive = true, + IsSystem = true, + Name = "Plumbing", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + Description = "Electric service involves the installation, maintenance, and repair of electrical systems, including wiring, lighting, and power distribution in buildings and infrastructure", + IsActive = true, + IsSystem = true, + Name = "Electric", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Description = "Fire fighting service involves installing and maintaining systems like sprinklers, hydrants, and alarms to detect, control, and extinguish fires in buildings and facilities.", + IsActive = true, + IsSystem = true, + Name = "Fire fighting", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Description = "HVAC (Heating, Ventilation, and Air Conditioning) service involves the installation, maintenance, and repair of systems that control indoor climate, air quality, and thermal comfort in buildings.", + IsActive = true, + IsSystem = true, + Name = "HVAC", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Description = "Interior infrastructure (Interior Infra) service involves the construction and installation of essential internal structural elements like partitions, ceilings, flooring, and utility layouts to prepare spaces for interior design and functional use.", + IsActive = true, + IsSystem = true, + Name = "Interior infrastructure", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Status") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + Status = "Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"), + Status = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), + Status = "On Hold", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), + Status = "In Active", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), + Status = "Completed", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketPriorityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketPriorityMasters"); + + b.HasData( + new + { + Id = new Guid("188d29b3-10f3-42d0-9587-1a46ae7a0320"), + ColorCode = "008000", + IsDefault = true, + Level = 1, + Name = "Low", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0919bc84-9f82-4ecf-98c7-962755dd9a97"), + ColorCode = "FFFF00", + IsDefault = true, + Level = 2, + Name = "Medium", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a13b7e59-16fd-4665-b5cf-a97399e8445a"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 3, + Name = "High", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("f340fbc3-c9fd-46aa-b063-0093418830e4"), + ColorCode = "#FFA500", + IsDefault = true, + Level = 4, + Name = "Critical", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44a7b91d-a0dd-45d1-8616-4d2f71e16401"), + ColorCode = "#FF0000", + IsDefault = true, + Level = 5, + Name = "Urgent", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketStatusMasters"); + + b.HasData( + new + { + Id = new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), + ColorCode = "#FFCC99", + Description = "This is a newly created issue.", + IsDefault = true, + Name = "New", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), + ColorCode = "#E6FF99", + Description = "Assigned to employee or team of employees", + IsDefault = true, + Name = "Assigned", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), + ColorCode = "#99E6FF", + Description = "These issues are currently in progress", + IsDefault = true, + Name = "In Progress", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), + ColorCode = "#6c757d", + Description = "These issues are currently under review", + IsDefault = true, + Name = "In Review", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8ff85685-a875-4f21-aa95-d99551315fcc"), + ColorCode = "#B399FF", + Description = "The following issues are resolved and closed", + IsDefault = true, + Name = "Done", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.TicketTagMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ColorCode") + .HasColumnType("longtext"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("TicketTagMasters"); + + b.HasData( + new + { + Id = new Guid("ef6c2a65-f61d-4537-9650-a7ab7f8d98db"), + ColorCode = "#e59866", + IsDefault = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("5a168569-8ad7-4422-8db6-51ef25caddeb"), + ColorCode = "#85c1e9", + IsDefault = true, + Name = "Help Desk", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkCategoryMasters"); + + b.HasData( + new + { + Id = new Guid("86bb2cc8-f6b5-4fdd-bbee-c389c713a44b"), + Description = "Created new task in a professional or creative context", + IsSystem = true, + Name = "Fresh Work", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9ebfa19c-53b9-481b-b863-c25d2f843201"), + Description = "Revising, modifying, or correcting a task to improve its quality or fix issues", + IsSystem = true, + Name = "Rework", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("11a79929-1d07-42dc-9e98-82d0d2f4a240"), + Description = "Any defect, deviation, or non-conformance in a task that fails to meet established standards or customer expectations.", + IsSystem = true, + Name = "Quality Issue", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkStatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkStatusMasters"); + + b.HasData( + new + { + Id = new Guid("030bb085-e230-4370-aec7-9a74d652864e"), + Description = "Confirm the tasks are actually finished as reported", + IsSystem = true, + Name = "Approve", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("2a1a5b96-cf93-4111-b4b1-76c19d6333b4"), + Description = "Not all tasks are actually finished as reported", + IsSystem = true, + Name = "Partially Approve", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("00a062e6-62e6-42c5-b6b1-024328651b72"), + Description = "Tasks are not finished as reported or have any issues in al the tasks", + IsSystem = true, + Name = "NCR", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BuildingId") + .HasColumnType("char(36)"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("char(36)"); + + b.Property("ShortName") + .HasColumnType("longtext"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = new Guid("85bf587b-7ca9-4685-b77c-d817f5847e85"), + ContactPerson = "Project 1 Contact Person", + EndDate = new DateTime(2026, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), + StartDate = new DateTime(2025, 4, 20, 10, 11, 17, 588, DateTimeKind.Unspecified), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("char(36)"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ActivityId") + .HasColumnType("char(36)"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("ParentTaskId") + .HasColumnType("char(36)"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.Property("WorkAreaId") + .HasColumnType("char(36)"); + + b.Property("WorkCategoryId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkCategoryId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Utilities.Inquiries", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("About") + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .HasColumnType("longtext"); + + b.Property("ContactPerson") + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("char(36)"); + + b.Property("OragnizationSize") + .HasColumnType("longtext"); + + b.Property("OrganizatioinName") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Inquiries"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "ApprovedBy") + .WithMany() + .HasForeignKey("ApprovedById"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "ReportedBy") + .WithMany() + .HasForeignKey("ReportedById"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.WorkStatusMaster", "WorkStatus") + .WithMany() + .HasForeignKey("WorkStatusId"); + + b.Navigation("ApprovedBy"); + + b.Navigation("Employee"); + + b.Navigation("ReportedBy"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + + b.Navigation("WorkStatus"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("CommentedBy") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskMembers", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") + .WithMany() + .HasForeignKey("TaskAllocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("TaskAllocation"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document") + .WithMany() + .HasForeignKey("DocumentId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Document"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.MPINDetails", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.OTPDetails", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.Contact", b => + { + b.HasOne("Marco.Pms.Model.Directory.ContactCategoryMaster", "ContactCategory") + .WithMany() + .HasForeignKey("ContactCategoryId"); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ContactCategory"); + + b.Navigation("CreatedBy"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactEmail", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactNote", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Createdby") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Createdby"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactPhone", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactProjectMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Directory.ContactTagMaster", "ContactTag") + .WithMany() + .HasForeignKey("ContactTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ContactTag"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.ContactTagMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.DirectoryUpdateLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Directory.EmployeeBucketMapping", b => + { + b.HasOne("Marco.Pms.Model.Directory.Bucket", "Bucket") + .WithMany() + .HasForeignKey("BucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Bucket"); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Roles.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Roles.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Master.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Roles.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Master.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketAttachment", b => + { + b.HasOne("Marco.Pms.Model.Forum.TicketComment", "TicketComment") + .WithMany("Attachments") + .HasForeignKey("CommentId"); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ticket"); + + b.Navigation("TicketComment"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketForum", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketPriorityMaster", "Priority") + .WithMany() + .HasForeignKey("PriorityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.TicketStatusMaster", "TicketStatusMaster") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketTypeMaster", "TicketTypeMaster") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Priority"); + + b.Navigation("Tenant"); + + b.Navigation("TicketStatusMaster"); + + b.Navigation("TicketTypeMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketTag", b => + { + b.HasOne("Marco.Pms.Model.Master.TicketTagMaster", "Tag") + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Forum.TicketForum", "Ticket") + .WithMany() + .HasForeignKey("TicketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tag"); + + b.Navigation("Ticket"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Mail.MailDetails", b => + { + b.HasOne("Marco.Pms.Model.Mail.MailingList", "MailBody") + .WithMany() + .HasForeignKey("MailListId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("MailBody"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityGroupMaster", b => + { + b.HasOne("Marco.Pms.Model.Master.ServicesMaster", "ServicesMaster") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ServicesMaster"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Master.ActivityGroupMaster", "ActivityGroupMaster") + .WithMany() + .HasForeignKey("ActitvityGroupId"); + + b.HasOne("Marco.Pms.Model.Master.ServicesMaster", "ServicesMaster") + .WithMany() + .HasForeignKey("ServiceId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityGroupMaster"); + + b.Navigation("ServicesMaster"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.HasOne("Marco.Pms.Model.Master.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ServicesMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkCategoryMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.WorkStatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Master.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Master.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Master.WorkCategoryMaster", "WorkCategoryMaster") + .WithMany() + .HasForeignKey("WorkCategoryId"); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkCategoryMaster"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Roles.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Forum.TicketComment", b => + { + b.Navigation("Attachments"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250625075520_Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table.cs b/Marco.Pms.DataAccess/Migrations/20250625075520_Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table.cs new file mode 100644 index 0000000..e0405aa --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250625075520_Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table.cs @@ -0,0 +1,79 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class Added_Forgien_Keys_In_Activity_And_ActivityGroup_Master_Table : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateIndex( + name: "IX_ActivityMasters_ActitvityGroupId", + table: "ActivityMasters", + column: "ActitvityGroupId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityMasters_ServiceId", + table: "ActivityMasters", + column: "ServiceId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityGroupMasters_ServiceId", + table: "ActivityGroupMasters", + column: "ServiceId"); + + migrationBuilder.AddForeignKey( + name: "FK_ActivityGroupMasters_ServicesMasters_ServiceId", + table: "ActivityGroupMasters", + column: "ServiceId", + principalTable: "ServicesMasters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_ActivityMasters_ActivityGroupMasters_ActitvityGroupId", + table: "ActivityMasters", + column: "ActitvityGroupId", + principalTable: "ActivityGroupMasters", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_ActivityMasters_ServicesMasters_ServiceId", + table: "ActivityMasters", + column: "ServiceId", + principalTable: "ServicesMasters", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ActivityGroupMasters_ServicesMasters_ServiceId", + table: "ActivityGroupMasters"); + + migrationBuilder.DropForeignKey( + name: "FK_ActivityMasters_ActivityGroupMasters_ActitvityGroupId", + table: "ActivityMasters"); + + migrationBuilder.DropForeignKey( + name: "FK_ActivityMasters_ServicesMasters_ServiceId", + table: "ActivityMasters"); + + migrationBuilder.DropIndex( + name: "IX_ActivityMasters_ActitvityGroupId", + table: "ActivityMasters"); + + migrationBuilder.DropIndex( + name: "IX_ActivityMasters_ServiceId", + table: "ActivityMasters"); + + migrationBuilder.DropIndex( + name: "IX_ActivityGroupMasters_ServiceId", + table: "ActivityGroupMasters"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index 98a3e93..f2ca548 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1883,26 +1883,305 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("MailingList"); }); + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityGroupMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ServiceId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityGroupMasters"); + + b.HasData( + new + { + Id = new Guid("6f048b41-f909-41dd-af5f-02369ca80639"), + Description = "Site Preparation involves clearing, leveling, and preparing the land for construction by removing obstacles, performing excavation, and conducting soil tests.", + IsActive = true, + IsSystem = true, + Name = "Site Preparation", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("1d29b7d1-ffdc-486d-ac7b-ee2661ae9979"), + Description = "Foundation Work involves excavating, reinforcing, and casting the base structure that supports the entire building load, including footings and plinth beams.", + IsActive = true, + IsSystem = true, + Name = "Foundation Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("3a712ddb-8927-4d58-8b24-83290e6ba8d1"), + Description = "Sub-Structure Work involves constructing the portion of the building below ground level, including plinth beams, basement walls, and backfilling, to support the superstructure.", + IsActive = true, + IsSystem = true, + Name = "Sub-Structure Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("47fa23fb-0e1c-459e-9cc9-9136c61effbd"), + Description = "Super-Structure Work involves constructing the part of the building above ground level, including columns, beams, slabs, and walls, forming the main structural framework.", + IsActive = true, + IsSystem = true, + Name = "Super-Structure Work", + ServiceId = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("7613959e-5718-4e46-926b-efa45722c844"), + Description = "Water Supply System involves installing pipelines, pumps, tanks, and fittings to ensure the reliable distribution of clean water throughout a building or facility.", + IsActive = true, + IsSystem = true, + Name = "Water Supply System", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("ba4ada9c-ed35-4d5e-bc9f-216f32612c85"), + Description = "Drainage & Wastewater System involves installing pipes, traps, and chambers to safely collect and dispose of wastewater and sewage from a building to the municipal or septic system.", + IsActive = true, + IsSystem = true, + Name = "Drainage & Wastewater System", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("44326c01-f69e-430c-a403-d5bf3dcc35d5"), + Description = "Rainwater Harvesting involves collecting, channeling, and storing rainwater from rooftops or surfaces for reuse or groundwater recharge.", + IsActive = true, + IsSystem = true, + Name = "Rainwater Harvesting", + ServiceId = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("3ef85f9f-e23e-4e6f-9cb7-40ec70a184dd"), + Description = "Conduiting & Cabling involves laying electrical conduits and pulling cables to safely route and protect electrical wiring throughout a building.", + IsActive = true, + IsSystem = true, + Name = "Conduiting & Cabling", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a71182a5-0579-4624-b252-4cae2ea11948"), + Description = "Wiring Installation involves connecting electrical wires from distribution boards to switches, sockets, and fixtures to provide power and lighting within a building.", + IsActive = true, + IsSystem = true, + Name = "Wiring Installation", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("b5e2291f-3569-45e5-9c30-ef33ad0abbf1"), + Description = "Lighting System involves installing and connecting various lighting fixtures, controls, and fittings to ensure proper illumination for indoor and outdoor areas.", + IsActive = true, + IsSystem = true, + Name = "Lighting System", + ServiceId = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("56584b0f-b2a5-4a5e-afea-590516473bcd"), + Description = "Sprinkler System involves installing a network of pipes and sprinkler heads designed to automatically discharge water to suppress or extinguish fires.", + IsActive = true, + IsSystem = true, + Name = "Sprinkler System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("78a12040-4ab6-493a-b199-ee636f45f77f"), + Description = "Fire Hydrant System involves installing external and internal hydrants, piping, and valves to provide high-pressure water access for manual firefighting during emergencies.", + IsActive = true, + IsSystem = true, + Name = "Fire Hydrant System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fbb04bec-53a7-4f86-8536-34c4b5c691a2"), + Description = "Liaisoning – Fire Fighting involves coordinating with fire authorities to obtain necessary approvals and no-objection certificates (NOCs) for fire safety systems, ensuring compliance with local fire safety regulations.", + IsActive = true, + IsSystem = true, + Name = "Liaisoning", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("6eedb9f1-22e9-4d93-b770-593125085465"), + Description = "Public Address (PA) System involves installing speakers, microphones, amplifiers, and control units to broadcast announcements, alerts, and emergency messages throughout a building or facility.", + IsActive = true, + IsSystem = true, + Name = "Public Address (PA) System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("97c6f9f5-cd4d-4830-ba14-a81f6ee0d1e2"), + Description = "Detection and Alarm System involves installing smoke detectors, heat sensors, and fire alarm panels to automatically detect fire or smoke and alert occupants through audible and visual alarms.", + IsActive = true, + IsSystem = true, + Name = "Detection and Alarm System", + ServiceId = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("cdea8e5f-8b78-4f7e-ab65-bd6b38d81af2"), + Description = "HVAC System Design & Planning involves calculating heating and cooling loads, selecting appropriate equipment, and designing duct and piping layouts to ensure efficient climate control and air quality.", + IsActive = true, + IsSystem = true, + Name = "HVAC System Design & Planning", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("1805e22d-4220-45cc-8f39-35194c2499a5"), + Description = "Ducting Work involves fabricating, installing, and insulating ducts to distribute conditioned air throughout the building as part of the HVAC system.", + IsActive = true, + IsSystem = true, + Name = "Ducting Work", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("69819ea6-5550-4325-9097-c52d95db0822"), + Description = "Equipment Installation involves setting up HVAC units such as AHUs, FCUs, chillers, and compressors to enable heating, cooling, and ventilation operations in the building.", + IsActive = true, + IsSystem = true, + Name = "Equipment Installation", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fe613446-c399-4a5c-8205-fd3652231f57"), + Description = "Ventilation System involves installing exhausts, fresh air units, and ductwork to ensure proper air circulation, removal of stale air, and maintenance of indoor air quality.", + IsActive = true, + IsSystem = true, + Name = "Ventilation System", + ServiceId = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("0398ba10-f814-404a-a7a2-3bac0f61a9a5"), + Description = "Partition Work involves constructing internal dividing walls using materials like gypsum, glass, or wood to create separate rooms or functional spaces within a building.", + IsActive = true, + IsSystem = true, + Name = "Partition Work", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("9efaa80a-f115-4e78-866a-5e192faa1024"), + Description = "False Ceiling Work involves installing suspended ceilings made of materials like gypsum, metal, or POP to conceal services, improve aesthetics, and enhance acoustic and thermal performance.", + IsActive = true, + IsSystem = true, + Name = "False Ceiling Work", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("c0a9e90c-4c74-417d-b36e-6e63eca16463"), + Description = "Door & Window Installation involves fitting and fixing doors and windows made of wood, aluminum, uPVC, or glass to provide access, ventilation, and natural light within the building.", + IsActive = true, + IsSystem = true, + Name = "Door & Window Installation", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("a27d502b-20ea-4926-b294-3db7110f94e5"), + Description = "Data & Communication Cabling involves laying structured cables for internet, telephone, and networking systems to ensure reliable communication and connectivity throughout the building.", + IsActive = true, + IsSystem = true, + Name = "Data & Communication Cabling", + ServiceId = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("char(36)"); + b.Property("ActitvityGroupId") + .HasColumnType("char(36)"); + b.Property("ActivityName") + .IsRequired() .HasColumnType("longtext"); b.Property("IsActive") .HasColumnType("tinyint(1)"); + b.Property("ServiceId") + .HasColumnType("char(36)"); + b.Property("TenantId") .HasColumnType("char(36)"); b.Property("UnitOfMeasurement") + .IsRequired() .HasColumnType("longtext"); b.HasKey("Id"); + b.HasIndex("ActitvityGroupId"); + + b.HasIndex("ServiceId"); + b.HasIndex("TenantId"); b.ToTable("ActivityMasters"); @@ -2451,6 +2730,92 @@ namespace Marco.Pms.DataAccess.Migrations }); }); + modelBuilder.Entity("Marco.Pms.Model.Master.ServicesMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsSystem") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ServicesMasters"); + + b.HasData( + new + { + Id = new Guid("0aa3e986-d6a4-49b4-818b-564d2d7799a2"), + Description = "Construction Civil service involves planning, designing, and overseeing infrastructure and building projects", + IsActive = true, + IsSystem = true, + Name = "Civil", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("fa208600-b761-480d-95ad-98cad2e61c9b"), + Description = "Plumbing service involves installing, maintaining, and repairing systems for water supply, drainage, and sewage in residential, commercial, and industrial buildings", + IsActive = true, + IsSystem = true, + Name = "Plumbing", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("e3c1d91d-7e86-4257-9c2d-04a4352d8283"), + Description = "Electric service involves the installation, maintenance, and repair of electrical systems, including wiring, lighting, and power distribution in buildings and infrastructure", + IsActive = true, + IsSystem = true, + Name = "Electric", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("da465f54-0f58-48c8-ab1d-8e31d59b3607"), + Description = "Fire fighting service involves installing and maintaining systems like sprinklers, hydrants, and alarms to detect, control, and extinguish fires in buildings and facilities.", + IsActive = true, + IsSystem = true, + Name = "Fire fighting", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("df3805d6-8d02-45cb-9c53-5c42b527ebb6"), + Description = "HVAC (Heating, Ventilation, and Air Conditioning) service involves the installation, maintenance, and repair of systems that control indoor climate, air quality, and thermal comfort in buildings.", + IsActive = true, + IsSystem = true, + Name = "HVAC", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }, + new + { + Id = new Guid("8d196e15-4099-4c9a-9a84-86650d79d4b4"), + Description = "Interior infrastructure (Interior Infra) service involves the construction and installation of essential internal structural elements like partitions, ceilings, flooring, and utility layouts to prepare spaces for interior design and functional use.", + IsActive = true, + IsSystem = true, + Name = "Interior infrastructure", + TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26") + }); + }); + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => { b.Property("Id") @@ -4143,14 +4508,45 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("MailBody"); }); - modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityGroupMaster", b => { + b.HasOne("Marco.Pms.Model.Master.ServicesMaster", "ServicesMaster") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("ServicesMaster"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Master.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Master.ActivityGroupMaster", "ActivityGroupMaster") + .WithMany() + .HasForeignKey("ActitvityGroupId"); + + b.HasOne("Marco.Pms.Model.Master.ServicesMaster", "ServicesMaster") + .WithMany() + .HasForeignKey("ServiceId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityGroupMaster"); + + b.Navigation("ServicesMaster"); + b.Navigation("Tenant"); }); @@ -4187,6 +4583,17 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Tenant"); }); + modelBuilder.Entity("Marco.Pms.Model.Master.ServicesMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + modelBuilder.Entity("Marco.Pms.Model.Master.StatusMaster", b => { b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") diff --git a/Marco.Pms.Model/Dtos/Activities/CreateActivityMasterDto.cs b/Marco.Pms.Model/Dtos/Activities/CreateActivityMasterDto.cs index 52deac2..5091c45 100644 --- a/Marco.Pms.Model/Dtos/Activities/CreateActivityMasterDto.cs +++ b/Marco.Pms.Model/Dtos/Activities/CreateActivityMasterDto.cs @@ -2,6 +2,8 @@ { public class CreateActivityMasterDto { + public Guid ActitvityGroupId { get; set; } + public Guid ServiceId { get; set; } public string? ActivityName { get; set; } public string? UnitOfMeasurement { get; set; } public List? CheckList { get; set; } diff --git a/Marco.Pms.Model/Dtos/Master/ActivityGroupDto.cs b/Marco.Pms.Model/Dtos/Master/ActivityGroupDto.cs new file mode 100644 index 0000000..6a48c05 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/ActivityGroupDto.cs @@ -0,0 +1,10 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class ActivityGroupDto + { + public Guid? Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public Guid ServiceId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Master/ServiceMasterDto.cs b/Marco.Pms.Model/Dtos/Master/ServiceMasterDto.cs new file mode 100644 index 0000000..c2313b3 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Master/ServiceMasterDto.cs @@ -0,0 +1,9 @@ +namespace Marco.Pms.Model.Dtos.Master +{ + public class ServiceMasterDto + { + public Guid? Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/ActivitiesMapper.cs b/Marco.Pms.Model/Mapper/ActivitiesMapper.cs index e2dc503..b65c09a 100644 --- a/Marco.Pms.Model/Mapper/ActivitiesMapper.cs +++ b/Marco.Pms.Model/Mapper/ActivitiesMapper.cs @@ -95,8 +95,11 @@ namespace Marco.Pms.Model.Mapper { return new ActivityMaster { - ActivityName = createActivity.ActivityName, - UnitOfMeasurement = createActivity.UnitOfMeasurement, + ServiceId = createActivity.ServiceId, + ActitvityGroupId = createActivity.ActitvityGroupId, + ActivityName = createActivity.ActivityName ?? string.Empty, + UnitOfMeasurement = createActivity.UnitOfMeasurement ?? string.Empty, + IsActive = true, TenantId = tenantId }; } @@ -135,13 +138,18 @@ namespace Marco.Pms.Model.Mapper }; } - public static ActivityVM ToActivityVMFromActivityMaster(this ActivityMaster activity, List checkList) + public static ActivityVM ToActivityVMFromActivityMaster(this ActivityMaster activity, List checkList, string? serviceName, string? activityGroupName) { return new ActivityVM { Id = activity.Id, + ServiceId = activity.ServiceId, + ServicesName = serviceName, + ActitvityGroupId = activity.ActitvityGroupId, + ActivityGroupName = activityGroupName, ActivityName = activity.ActivityName, UnitOfMeasurement = activity.UnitOfMeasurement, + IsActive = activity.IsActive, CheckLists = checkList, }; } diff --git a/Marco.Pms.Model/Mapper/MasterMapper.cs b/Marco.Pms.Model/Mapper/MasterMapper.cs index 548c162..e6ae857 100644 --- a/Marco.Pms.Model/Mapper/MasterMapper.cs +++ b/Marco.Pms.Model/Mapper/MasterMapper.cs @@ -27,5 +27,53 @@ namespace Marco.Pms.Model.Mapper IsSystem = categoryMaster.IsSystem }; } + + // -------------------------------- Services -------------------------------- + public static ServicesMaster ToServicesMasterFromServiceMasterDto(this ServiceMasterDto model, Guid tenantId) + { + return new ServicesMaster + { + Name = model.Name ?? string.Empty, + Description = model.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ServiceMasterVM ToServiceMasterVMFromServiceMaster(this ServicesMaster model) + { + return new ServiceMasterVM + { + Id = model.Id, + Name = model.Name, + Description = model.Description, + IsActive = model.IsActive, + IsSystem = model.IsSystem + }; + } + + // -------------------------------- Activity Group -------------------------------- + + public static ActivityGroupMaster ToActivityGroupMasterFromActivityGroupDto(this ActivityGroupDto model, Guid tenantId) + { + return new ActivityGroupMaster + { + ServiceId = model.ServiceId, + Name = model.Name ?? string.Empty, + Description = model.Description ?? string.Empty, + TenantId = tenantId + }; + } + public static ActivityGroupMasterVM ToActivityGroupMasterVMFromActivityGroupMaster(this ActivityGroupMaster model, string serviceName) + { + return new ActivityGroupMasterVM + { + Id = model.Id, + ServiceId = model.ServiceId, + ServicesName = serviceName, + Name = model.Name ?? string.Empty, + Description = model.Description ?? string.Empty, + IsActive = model.IsActive, + IsSystem = model.IsSystem + }; + } } } diff --git a/Marco.Pms.Model/Master/ActivityGroupMaster.cs b/Marco.Pms.Model/Master/ActivityGroupMaster.cs new file mode 100644 index 0000000..515b04d --- /dev/null +++ b/Marco.Pms.Model/Master/ActivityGroupMaster.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; + +namespace Marco.Pms.Model.Master +{ + public class ActivityGroupMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public Guid ServiceId { get; set; } + + [ValidateNever] + [ForeignKey("ServiceId")] + public ServicesMaster? ServicesMaster { get; set; } + public bool IsSystem { get; set; } = false; + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/Master/ActivityMaster.cs b/Marco.Pms.Model/Master/ActivityMaster.cs index 26b018e..f86e7fc 100644 --- a/Marco.Pms.Model/Master/ActivityMaster.cs +++ b/Marco.Pms.Model/Master/ActivityMaster.cs @@ -1,14 +1,24 @@ -using Marco.Pms.Model.Utilities; +using System.ComponentModel.DataAnnotations.Schema; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; namespace Marco.Pms.Model.Master { public class ActivityMaster : TenantRelation { public Guid Id { get; set; } - public string? ActivityName { get; set; } + public Guid? ActitvityGroupId { get; set; } - public string? UnitOfMeasurement { get; set; } + [ValidateNever] + [ForeignKey("ActitvityGroupId")] + public ActivityGroupMaster? ActivityGroupMaster { get; set; } + public Guid? ServiceId { get; set; } + [ValidateNever] + [ForeignKey("ServiceId")] + public ServicesMaster? ServicesMaster { get; set; } + public string ActivityName { get; set; } = string.Empty; + public string UnitOfMeasurement { get; set; } = string.Empty; public bool IsActive { get; set; } = true; } } diff --git a/Marco.Pms.Model/Master/ServicesMaster.cs b/Marco.Pms.Model/Master/ServicesMaster.cs new file mode 100644 index 0000000..fc2129b --- /dev/null +++ b/Marco.Pms.Model/Master/ServicesMaster.cs @@ -0,0 +1,13 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Master +{ + public class ServicesMaster : TenantRelation + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public bool IsSystem { get; set; } = false; + public bool IsActive { get; set; } = true; + } +} diff --git a/Marco.Pms.Model/ViewModels/Activities/ActivityVM.cs b/Marco.Pms.Model/ViewModels/Activities/ActivityVM.cs index 38c9d9f..67f4a1c 100644 --- a/Marco.Pms.Model/ViewModels/Activities/ActivityVM.cs +++ b/Marco.Pms.Model/ViewModels/Activities/ActivityVM.cs @@ -4,8 +4,12 @@ { public Guid Id { get; set; } public string? ActivityName { get; set; } - public string? UnitOfMeasurement { get; set; } + public Guid? ActitvityGroupId { get; set; } + public string? ActivityGroupName { get; set; } + public Guid? ServiceId { get; set; } + public string? ServicesName { get; set; } + public bool IsActive { get; set; } public List? CheckLists { get; set; } } } diff --git a/Marco.Pms.Model/ViewModels/Master/ActivityGroupMasterVM.cs b/Marco.Pms.Model/ViewModels/Master/ActivityGroupMasterVM.cs new file mode 100644 index 0000000..b13ea45 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ActivityGroupMasterVM.cs @@ -0,0 +1,13 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ActivityGroupMasterVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public Guid ServiceId { get; set; } + public string? ServicesName { get; set; } + public bool IsSystem { get; set; } + public bool IsActive { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Master/ServiceMasterVM.cs b/Marco.Pms.Model/ViewModels/Master/ServiceMasterVM.cs new file mode 100644 index 0000000..51f741b --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Master/ServiceMasterVM.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.ViewModels.Master +{ + public class ServiceMasterVM + { + public Guid Id { get; set; } + public string? Name { get; set; } + public string? Description { get; set; } + public bool IsSystem { get; set; } + public bool IsActive { get; set; } + } +} diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs index bcc4264..a1f9940 100644 --- a/Marco.Pms.Services/Controllers/MasterController.cs +++ b/Marco.Pms.Services/Controllers/MasterController.cs @@ -1,12 +1,10 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; -using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Forum; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Master; using Marco.Pms.Model.Utilities; -using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Forum; using Marco.Pms.Model.ViewModels.Master; using Marco.Pms.Services.Helpers; @@ -40,156 +38,99 @@ namespace Marco.Pms.Services.Controllers tenantId = userHelper.GetTenantId(); } + #region =================================================================== Services APIs =================================================================== + + [HttpGet("services")] + public async Task GetServices() + { + var response = await _masterHelper.GetServices(); + return StatusCode(response.StatusCode, response); + } + + [HttpPost("service")] + public async Task CreateService([FromBody] ServiceMasterDto serviceMasterDto) + { + var response = await _masterHelper.CreateService(serviceMasterDto); + return StatusCode(response.StatusCode, response); + } + + [HttpPut("service/{id}")] + public async Task UpdateService(Guid id, [FromBody] ServiceMasterDto serviceMasterDto) + { + var response = await _masterHelper.UpdateService(id, serviceMasterDto); + return StatusCode(response.StatusCode, response); + } + + [HttpDelete("service/{id}")] + public async Task DeleteService(Guid id, [FromQuery] bool? isActive) + { + var response = await _masterHelper.DeleteService(id, isActive ?? false); + return StatusCode(response.StatusCode, response); + } + + #endregion + + #region =================================================================== Activity Group APIs =================================================================== + + [HttpGet("activity-groups")] + public async Task GetActivityGroups() + { + var response = await _masterHelper.GetActivityGroups(); + return StatusCode(response.StatusCode, response); + } + + [HttpPost("activity-group")] + public async Task CreateActivityGroup([FromBody] ActivityGroupDto activityGroupDto) + { + var response = await _masterHelper.CreateActivityGroup(activityGroupDto); + return StatusCode(response.StatusCode, response); + } + + [HttpPut("activity-group/{id}")] + public async Task UpdateActivityGroup(Guid id, [FromBody] ActivityGroupDto activityGroupDto) + { + var response = await _masterHelper.UpdateActivityGroup(id, activityGroupDto); + return StatusCode(response.StatusCode, response); + + } + + [HttpDelete("activity-group/{id}")] + public async Task DeleteActivityGroup(Guid id, [FromQuery] bool? isActive) + { + var response = await _masterHelper.DeleteActivityGroup(id, isActive ?? false); + return StatusCode(response.StatusCode, response); + } + #endregion + #region =================================================================== Activity APIs =================================================================== - [HttpGet] - [Route("activities")] + [HttpGet("activities")] public async Task GetActivitiesMaster() { - Guid tenantId = _userHelper.GetTenantId(); - var activities = await _context.ActivityMasters.Where(c => c.TenantId == tenantId && c.IsActive == true).ToListAsync(); - List activitiesVM = new List(); - foreach (var activity in activities) - { - var checkList = await _context.ActivityCheckLists.Where(c => c.TenantId == tenantId && c.ActivityId == activity.Id).ToListAsync(); - List checkListVM = new List(); - if (checkList != null) - { - foreach (ActivityCheckList check in checkList) - { - var checkVM = check.ToCheckListVMFromActivityCheckList(activity.Id, false); - checkListVM.Add(checkVM); - } - } - - ActivityVM activityVM = activity.ToActivityVMFromActivityMaster(checkListVM); - activitiesVM.Add(activityVM); - } - _logger.LogInfo("{count} activity records fetched successfully from tenant {tenantId}", activitiesVM.Count, tenantId); - return Ok(ApiResponse.SuccessResponse(activitiesVM, System.String.Format("{0} activity records fetched successfully", activitiesVM.Count), 200)); + var response = await _masterHelper.GetActivitiesMaster(); + return StatusCode(response.StatusCode, response); } [HttpPost("activity")] public async Task CreateActivity([FromBody] CreateActivityMasterDto createActivity) { - Guid tenantId = _userHelper.GetTenantId(); - var employee = await _userHelper.GetCurrentEmployeeAsync(); - if (employee.TenantId != tenantId) - { - _logger.LogWarning("User from tenant {employeeTenantId} tries to access data from tenant {tenantId}", employee.TenantId, tenantId); - return Unauthorized(ApiResponse.ErrorResponse("Current tenant did not match with user's tenant", "Current tenant did not match with user's tenant", 401)); - } - var activityMaster = createActivity.ToActivityMasterFromCreateActivityMasterDto(tenantId); - _context.ActivityMasters.Add(activityMaster); - await _context.SaveChangesAsync(); - List checkListVM = new List(); - - if (createActivity.CheckList != null) - { - List activityCheckList = new List(); - foreach (var check in createActivity.CheckList) - { - ActivityCheckList checkList = check.ToActivityCheckListFromCreateCheckListDto(tenantId, activityMaster.Id); - activityCheckList.Add(checkList); - } - _context.ActivityCheckLists.AddRange(activityCheckList); - await _context.SaveChangesAsync(); - - foreach (ActivityCheckList check in activityCheckList) - { - var checkVM = check.ToCheckListVMFromActivityCheckList(activityMaster.Id, false); - checkListVM.Add(checkVM); - } - } - ActivityVM activityVM = activityMaster.ToActivityVMFromActivityMaster(checkListVM); - - _logger.LogInfo("activity created successfully from tenant {tenantId}", tenantId); - return Ok(ApiResponse.SuccessResponse(activityVM, "activity created successfully", 200)); + var response = await _masterHelper.CreateActivity(createActivity); + return StatusCode(response.StatusCode, response); } - [HttpPost("activity/edit/{id}")] + [HttpPut("activity/{id}")] public async Task UpdateActivity(Guid id, [FromBody] CreateActivityMasterDto createActivity) { - Guid tenantId = _userHelper.GetTenantId(); - var employee = await _userHelper.GetCurrentEmployeeAsync(); - ActivityMaster? activity = await _context.ActivityMasters.FirstOrDefaultAsync(x => x.Id == id && x.IsActive == true && x.TenantId == tenantId); - if (activity != null && createActivity.UnitOfMeasurement != null && createActivity.ActivityName != null) - { + var response = await _masterHelper.UpdateActivity(id, createActivity); + return StatusCode(response.StatusCode, response); - activity.ActivityName = createActivity.ActivityName; - activity.UnitOfMeasurement = createActivity.UnitOfMeasurement; - List activityCheckLists = await _context.ActivityCheckLists.AsNoTracking().Where(c => c.ActivityId == activity.Id).ToListAsync(); - List checkListVM = new List(); - - if (createActivity.CheckList != null) - { - - var newCheckIds = createActivity.CheckList.Select(c => c.Id); - - List updateCheckList = new List(); - List deleteCheckList = new List(); - if (newCheckIds.Contains(null)) - { - foreach (var check in createActivity.CheckList) - { - if (check.Id == null) - { - ActivityCheckList checkList = check.ToActivityCheckListFromCreateCheckListDto(tenantId, activity.Id); - updateCheckList.Add(checkList); - } - } - } - foreach (var check in activityCheckLists) - { - if (newCheckIds.Contains(check.Id)) - { - var updatedCheck = createActivity.CheckList.Find(c => c.Id == check.Id); - ActivityCheckList checkList = updatedCheck != null ? updatedCheck.ToActivityCheckListFromCreateCheckListDto(tenantId, activity.Id) : new ActivityCheckList(); - updateCheckList.Add(checkList); - } - else - { - deleteCheckList.Add(check); - } - } - _context.ActivityCheckLists.UpdateRange(updateCheckList); - if (deleteCheckList != null) - { - _context.ActivityCheckLists.RemoveRange(deleteCheckList); - } - await _context.SaveChangesAsync(); - - foreach (ActivityCheckList check in updateCheckList) - { - var checkVM = check.ToCheckListVMFromActivityCheckList(activity.Id, false); - checkListVM.Add(checkVM); - } - } - else if (activityCheckLists != null) - { - _context.ActivityCheckLists.RemoveRange(activityCheckLists); - await _context.SaveChangesAsync(); - } - ActivityVM activityVM = activity.ToActivityVMFromActivityMaster(checkListVM); - _logger.LogInfo("activity updated successfully from tenant {tenantId}", tenantId); - return Ok(ApiResponse.SuccessResponse(activityVM, "activity updated successfully", 200)); - } - _logger.LogWarning("Activity {ActivityId} not found", id); - return NotFound(ApiResponse.ErrorResponse("Activity not found", "Activity not found", 404)); } - [HttpDelete("activity/delete/{id}")] - public async Task DeleteActivity(Guid Id) + [HttpDelete("activity/{id}")] + public async Task DeleteActivity(Guid id, [FromQuery] bool? isActive) { - Guid tenantId = _userHelper.GetTenantId(); - var activity = await _context.ActivityMasters.FirstOrDefaultAsync(a => a.Id == Id && a.TenantId == tenantId); - if (activity != null) - { - activity.IsActive = false; - } - await _context.SaveChangesAsync(); - _logger.LogInfo("Activity Deleted Successfully from tenant {tenantId}", tenantId); - return Ok(ApiResponse.SuccessResponse(new { }, "Activity Deleted Successfully", 200)); + var response = await _masterHelper.DeleteActivity(id, isActive ?? false); + return StatusCode(response.StatusCode, response); } #endregion diff --git a/Marco.Pms.Services/Helpers/MasterHelper.cs b/Marco.Pms.Services/Helpers/MasterHelper.cs index d50a603..4450abd 100644 --- a/Marco.Pms.Services/Helpers/MasterHelper.cs +++ b/Marco.Pms.Services/Helpers/MasterHelper.cs @@ -1,11 +1,13 @@ using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Directory; +using Marco.Pms.Model.Dtos.Activities; using Marco.Pms.Model.Dtos.Master; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using Marco.Pms.Model.Mapper; using Marco.Pms.Model.Master; using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Activities; using Marco.Pms.Model.ViewModels.Master; using Marco.Pms.Services.Service; using MarcoBMS.Services.Helpers; @@ -19,19 +21,666 @@ namespace Marco.Pms.Services.Helpers private readonly ApplicationDbContext _context; private readonly ILoggingService _logger; private readonly UserHelper _userHelper; - private readonly PermissionServices _permission; + private readonly PermissionServices _permissionService; private readonly Guid tenantId; - public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper, PermissionServices permission) + public MasterHelper(ApplicationDbContext context, ILoggingService logger, UserHelper userHelper, PermissionServices permissionServices) { _context = context; _logger = logger; _userHelper = userHelper; - _permission = permission; - tenantId = userHelper.GetTenantId(); + _permissionService = permissionServices; + tenantId = _userHelper.GetTenantId(); } - #region =================================================================== Contact Category APIs =================================================================== + #region =================================================================== Services APIs =================================================================== + public async Task> GetServices() + { + _logger.LogInfo("GetServices called"); + try + { + // Step 1: Get current logged-in employee + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + // Step 2: Fetch services for the tenant + var services = await _context.ServicesMasters + .Where(s => s.TenantId == tenantId && s.IsActive) + .Select(s => s.ToServiceMasterVMFromServiceMaster()) + .ToListAsync(); + + _logger.LogInfo("Fetched {Count} service records for tenantId: {TenantId}", services.Count, tenantId); + + return ApiResponse.SuccessResponse(services, $"{services.Count} record(s) of services fetched successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error fetching services"); + return ApiResponse.ErrorResponse("An error occurred while fetching services", ex.Message, 500); + } + } + public async Task> CreateService(ServiceMasterDto serviceMasterDto) + { + _logger.LogInfo("CreateService called with Name: {ServiceName}", serviceMasterDto?.Name ?? "null"); + + try + { + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + // Step 1: Permission check + var hasManagePermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + if (!hasManagePermission) + { + _logger.LogWarning("Access denied for employeeId: {EmployeeId}", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("You don't have access", "You don't have permission to take this action", 403); + } + + // Step 2: Validate input + if (string.IsNullOrWhiteSpace(serviceMasterDto?.Name) || + string.IsNullOrWhiteSpace(serviceMasterDto?.Description)) + { + _logger.LogWarning("Invalid input data for service creation by employeeId: {EmployeeId}", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid data", "Name and Description are required", 400); + } + + // Step 3: Check for duplicate name + bool isExist = await _context.ServicesMasters + .AnyAsync(s => s.TenantId == tenantId && s.Name.ToLower() == serviceMasterDto.Name.ToLower()); + + if (isExist) + { + _logger.LogWarning("Duplicate service name '{ServiceName}' attempted by employeeId: {EmployeeId}", serviceMasterDto.Name, loggedInEmployee.Id); + return ApiResponse.ErrorResponse( + $"Service with name '{serviceMasterDto.Name}' already exists", + $"Service with name '{serviceMasterDto.Name}' already exists", 400); + } + + // Step 4: Save new service + ServicesMaster service = serviceMasterDto.ToServicesMasterFromServiceMasterDto(tenantId); + _context.ServicesMasters.Add(service); + await _context.SaveChangesAsync(); + + var response = service.ToServiceMasterVMFromServiceMaster(); + + _logger.LogInfo("New service '{ServiceName}' created successfully by employeeId: {EmployeeId}", service.Name, loggedInEmployee.Id); + + return ApiResponse.SuccessResponse(response, "New service created successfully", 201); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error creating service"); + return ApiResponse.ErrorResponse("Failed to create service", ex.Message, 500); + } + } + public async Task> UpdateService(Guid id, ServiceMasterDto serviceMasterDto) + { + _logger.LogInfo("UpdateService called for Id: {Id}", id); + + try + { + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + // Step 1: Permission check + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + if (!hasPermission) + { + _logger.LogWarning("Access denied. EmployeeId: {EmployeeId} lacks Manage_Master permission.", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to take this action", 403); + } + + // Step 2: Input validation + if (serviceMasterDto == null || serviceMasterDto.Id != id || + string.IsNullOrWhiteSpace(serviceMasterDto.Name) || + string.IsNullOrWhiteSpace(serviceMasterDto.Description)) + { + _logger.LogWarning("Invalid input data provided for UpdateService. Id: {Id}", id); + return ApiResponse.ErrorResponse("Invalid input", "Please provide valid service data", 400); + } + + // Step 3: Retrieve service + var service = await _context.ServicesMasters + .FirstOrDefaultAsync(s => s.Id == id && s.TenantId == tenantId && s.IsActive); + + if (service == null) + { + _logger.LogWarning("Service not found for Id: {Id}, Tenant: {TenantId}", id, tenantId); + return ApiResponse.ErrorResponse("Service not found", "The requested service does not exist", 404); + } + + // Step 4: Update and save + service.Name = serviceMasterDto.Name.Trim(); + service.Description = serviceMasterDto.Description.Trim(); + + await _context.SaveChangesAsync(); + + var response = service.ToServiceMasterVMFromServiceMaster(); + + _logger.LogInfo("Service updated successfully. Id: {Id}, TenantId: {TenantId}", service.Id, tenantId); + return ApiResponse.SuccessResponse(response, "Service updated successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error while updating service Id: {Id}.", id); + return ApiResponse.ErrorResponse("An error occurred while updating the service", ex.Message, 500); + } + } + public async Task> DeleteService(Guid id, bool isActive) + { + _logger.LogInfo("DeleteService called with ServiceId: {ServiceId}, IsActive: {IsActive}", id, isActive); + + try + { + // Step 1: Get current user and validate permission + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + + if (!hasPermission) + { + _logger.LogWarning("Access denied. EmployeeId: {EmployeeId} does not have Manage_Master permission.", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to delete services", 403); + } + + // Step 2: Check if the service exists + var service = await _context.ServicesMasters + .FirstOrDefaultAsync(s => s.Id == id && s.TenantId == tenantId); + + if (service == null) + { + _logger.LogWarning("Service not found. ServiceId: {ServiceId}", id); + return ApiResponse.ErrorResponse("Service not found", "Service not found or already deleted", 404); + } + + // Protect system-defined service + if (service.IsSystem) + { + _logger.LogWarning("Attempt to delete system-defined service. ServiceId: {ServiceId}", id); + return ApiResponse.ErrorResponse("Cannot delete system-defined service", "This service is system-defined and cannot be deleted", 400); + } + + // Step 3: Soft delete or restore + service.IsActive = isActive; + await _context.SaveChangesAsync(); + + var status = isActive ? "restored" : "deactivated"; + _logger.LogInfo("Service {ServiceId} has been {Status} successfully by EmployeeId: {EmployeeId}", id, status, loggedInEmployee.Id); + + return ApiResponse.SuccessResponse(new { }, $"Service {status} successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Unexpected error occurred while deleting service {ServiceId}", id); + return ApiResponse.ErrorResponse("Error deleting service", ex.Message, 500); + } + } + #endregion + + #region =================================================================== Activity Group APIs =================================================================== + + public async Task> GetActivityGroups() + { + _logger.LogInfo("GetActivityGroups called"); + + try + { + // Step 1: Get logged-in employee + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + // Step 2: Fetch all activity groups for the tenant + var activityGroups = await _context.ActivityGroupMasters + .Include(ag => ag.ServicesMaster) + .Where(ag => ag.TenantId == tenantId && ag.IsActive) + .Select(ag => ag.ToActivityGroupMasterVMFromActivityGroupMaster(ag.ServicesMaster != null ? ag.ServicesMaster.Name : "")) + .ToListAsync(); + + _logger.LogInfo("{Count} activity group(s) fetched for tenantId: {TenantId}", activityGroups.Count, tenantId); + + return ApiResponse.SuccessResponse(activityGroups, $"{activityGroups.Count} record(s) of activity groups fetched successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error fetching activity groups"); + return ApiResponse.ErrorResponse("An error occurred while fetching activity groups", ex.Message, 500); + } + } + public async Task> CreateActivityGroup(ActivityGroupDto activityGroupDto) + { + _logger.LogInfo("CreateActivityGroup called with Name: {Name}", activityGroupDto?.Name ?? "null"); + + try + { + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + // Step 1: Check Manage Master permission + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + if (!hasPermission) + { + _logger.LogWarning("Access denied. EmployeeId: {EmployeeId} lacks Manage_Master permission", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to take this action", 403); + } + + // Step 2: Validate input + if (string.IsNullOrWhiteSpace(activityGroupDto?.Name) || string.IsNullOrWhiteSpace(activityGroupDto.Description)) + { + _logger.LogWarning("Invalid input data for activity group by employeeId: {EmployeeId}", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Invalid input", "Name and Description are required", 400); + } + + // Step 3: Check for duplicate name within ActivityGroupMasters + bool isExist = await _context.ActivityGroupMasters + .AnyAsync(ag => ag.TenantId == tenantId && ag.Name.ToLower() == activityGroupDto.Name.ToLower()); + + if (isExist) + { + _logger.LogWarning("Duplicate activity group name '{Name}' attempted by employeeId: {EmployeeId}", activityGroupDto.Name, loggedInEmployee.Id); + return ApiResponse.ErrorResponse( + $"Activity group with name '{activityGroupDto.Name}' already exists", + $"Activity group with name '{activityGroupDto.Name}' already exists", 400); + } + + // Step 4: Map and persist + var activityGroup = activityGroupDto.ToActivityGroupMasterFromActivityGroupDto(tenantId); + _context.ActivityGroupMasters.Add(activityGroup); + await _context.SaveChangesAsync(); + + var service = await _context.ServicesMasters.FirstOrDefaultAsync(s => s.Id == activityGroup.ServiceId); + + var response = activityGroup.ToActivityGroupMasterVMFromActivityGroupMaster(service?.Name ?? ""); + + _logger.LogInfo("New activity group '{Name}' created successfully by employeeId: {EmployeeId}", activityGroup.Name, loggedInEmployee.Id); + return ApiResponse.SuccessResponse(response, "New activity group created successfully", 201); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error creating activity group"); + return ApiResponse.ErrorResponse("Failed to create activity group", ex.Message, 500); + } + } + public async Task> UpdateActivityGroup(Guid id, ActivityGroupDto activityGroupDto) + { + _logger.LogInfo("UpdateActivityGroup called for Id: {Id}", id); + + try + { + // Step 1: Permission check + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + if (!hasPermission) + { + _logger.LogWarning("Access denied. EmployeeId: {EmployeeId} lacks Manage_Master permission.", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to take this action", 403); + } + + // Step 2: Input validation + if (activityGroupDto == null || activityGroupDto.Id != id || + string.IsNullOrWhiteSpace(activityGroupDto.Name) || + string.IsNullOrWhiteSpace(activityGroupDto.Description)) + { + _logger.LogWarning("Invalid input for activity group update. Id: {Id}", id); + return ApiResponse.ErrorResponse("Invalid input", "Please provide valid data to update activity group", 400); + } + + var service = await _context.ServicesMasters.FirstOrDefaultAsync(s => s.Id == activityGroupDto.ServiceId && s.IsActive); + + if (service == null) + { + _logger.LogWarning("User tries to update activity group, but service not found"); + return ApiResponse.ErrorResponse("Invalid service ID", "Please provide valid service ID to update activity group", 400); + } + + // Step 3: Retrieve existing activity group + var activityGroup = await _context.ActivityGroupMasters + .Include(ag => ag.ServicesMaster) + .FirstOrDefaultAsync(ag => ag.Id == id && ag.TenantId == tenantId && ag.IsActive); + + if (activityGroup == null) + { + _logger.LogWarning("Activity group not found. Id: {Id}, TenantId: {TenantId}", id, tenantId); + return ApiResponse.ErrorResponse("Activity group not found", "No such activity group exists", 404); + } + + // Step 4: Update and save + activityGroup.Name = activityGroupDto.Name.Trim(); + activityGroup.Description = activityGroupDto.Description.Trim(); + + await _context.SaveChangesAsync(); + + var response = activityGroup.ToActivityGroupMasterVMFromActivityGroupMaster(service.Name ?? ""); + + _logger.LogInfo("Activity group updated successfully. Id: {Id}, TenantId: {TenantId}", activityGroup.Id, tenantId); + return ApiResponse.SuccessResponse(response, "Activity group updated successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error while updating activity group Id: {Id}", id); + return ApiResponse.ErrorResponse("An error occurred while updating the activity group", ex.Message, 500); + } + } + public async Task> DeleteActivityGroup(Guid id, bool isActive) + { + _logger.LogInfo("DeleteActivityGroup called with ActivityGroupId: {ActivityGroupId}, IsActive: {IsActive}", id, isActive); + + try + { + // Step 1: Permission check + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + + if (!hasPermission) + { + _logger.LogWarning("Access denied. EmployeeId: {EmployeeId} does not have Manage_Master permission.", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to delete activity groups", 403); + } + + // Step 2: Fetch the activity group + var activityGroup = await _context.ActivityGroupMasters + .FirstOrDefaultAsync(ag => ag.Id == id && ag.TenantId == tenantId); + + if (activityGroup == null) + { + _logger.LogWarning("ActivityGroup not found. Id: {ActivityGroupId}", id); + return ApiResponse.ErrorResponse("Activity group not found", "Activity group not found or already deleted", 404); + } + + //Protect system-defined activity group + if (activityGroup.IsSystem) + { + _logger.LogWarning("Attempt to delete system-defined activity group. Id: {ActivityGroupId}", id); + return ApiResponse.ErrorResponse("Cannot delete system-defined activity group", "This activity group is system-defined and cannot be deleted", 400); + } + + // Step 3: Perform soft delete or restore + activityGroup.IsActive = isActive; + await _context.SaveChangesAsync(); + + var status = isActive ? "restored" : "deactivated"; + _logger.LogInfo("ActivityGroup {ActivityGroupId} has been {Status} by EmployeeId: {EmployeeId}", id, status, loggedInEmployee.Id); + + return ApiResponse.SuccessResponse(new { }, $"Activity group {status} successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Unexpected error occurred while deleting ActivityGroup {ActivityGroupId}", id); + return ApiResponse.ErrorResponse("Error deleting activity group", ex.Message, 500); + } + } + + + #endregion + + #region =================================================================== Activity APIs =================================================================== + public async Task> GetActivitiesMaster() + { + _logger.LogInfo("GetActivitiesMaster called"); + + try + { + + // Step 1: Fetch all active activities for the tenant + var activities = await _context.ActivityMasters + .Include(c => c.ServicesMaster) + .Include(c => c.ActivityGroupMaster) + .Where(c => c.TenantId == tenantId && c.IsActive) + .ToListAsync(); + + if (activities.Count == 0) + { + _logger.LogWarning("No active activities found for tenantId: {TenantId}", tenantId); + return ApiResponse.SuccessResponse(new List(), "No activity records found", 200); + } + + // Step 2: Fetch all checklists for those activities in a single query to avoid N+1 + var activityIds = activities.Select(a => a.Id).ToList(); + var checkLists = await _context.ActivityCheckLists + .Where(c => c.TenantId == tenantId && activityIds.Contains(c.ActivityId)) + .ToListAsync(); + + // Step 3: Group checklists by activity + var groupedChecklists = checkLists + .GroupBy(c => c.ActivityId) + .ToDictionary(g => g.Key, g => g.ToList()); + + // Step 4: Map to ViewModel + var activityVMs = activities.Select(activity => + { + var checklistForActivity = groupedChecklists.ContainsKey(activity.Id) + ? groupedChecklists[activity.Id] + : new List(); + + var checklistVMs = checklistForActivity + .Select(cl => cl.ToCheckListVMFromActivityCheckList(activity.Id, false)) + .ToList(); + + return activity.ToActivityVMFromActivityMaster(checklistVMs, activity.ServicesMaster?.Name, activity.ActivityGroupMaster?.Name); + }).ToList(); + + _logger.LogInfo("{Count} activity records fetched successfully for tenantId: {TenantId}", activityVMs.Count, tenantId); + + return ApiResponse.SuccessResponse(activityVMs, $"{activityVMs.Count} activity records fetched successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error occurred in GetActivitiesMaster"); + return ApiResponse.ErrorResponse("Failed to fetch activity records", ex.Message, 500); + } + } + public async Task> CreateActivity(CreateActivityMasterDto createActivity) + { + _logger.LogInfo("CreateActivity called with ActivityName: {Name}", createActivity?.ActivityName ?? "null"); + + try + { + // Step 1: Validate input + if (createActivity == null) + { + _logger.LogWarning("Null request body received in CreateActivity"); + return ApiResponse.ErrorResponse("Invalid input", "Activity data is required", 400); + } + + var activityGroup = await _context.ActivityGroupMasters + .Include(ag => ag.ServicesMaster) + .FirstOrDefaultAsync(ag => ag.Id == createActivity.ActitvityGroupId && ag.ServiceId == createActivity.ServiceId); + if (activityGroup == null) + { + _logger.LogWarning("User tried to create new activity, but not found activity group"); + return ApiResponse.ErrorResponse("Invalid input", "Activity data is required", 400); + } + + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + + // Step 2: Check permissions + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + if (!hasPermission) + { + _logger.LogWarning("Access denied. EmployeeId: {EmployeeId} does not have Manage_Master permission.", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to perform this action", 403); + } + + // Step 3: Convert DTO to entity and add activity + var activityMaster = createActivity.ToActivityMasterFromCreateActivityMasterDto(tenantId); + _context.ActivityMasters.Add(activityMaster); + await _context.SaveChangesAsync(); + + List checkListVMs = new(); + + // Step 4: Handle checklist items if present + if (createActivity.CheckList?.Any() == true) + { + var activityCheckLists = createActivity.CheckList + .Select(c => c.ToActivityCheckListFromCreateCheckListDto(tenantId, activityMaster.Id)) + .ToList(); + + _context.ActivityCheckLists.AddRange(activityCheckLists); + await _context.SaveChangesAsync(); + + checkListVMs = activityCheckLists + .Select(c => c.ToCheckListVMFromActivityCheckList(activityMaster.Id, false)) + .ToList(); + } + + // Step 5: Prepare final response + var activityVM = activityMaster.ToActivityVMFromActivityMaster(checkListVMs, activityGroup.ServicesMaster?.Name, activityGroup.Name); + + _logger.LogInfo("Activity '{Name}' created successfully for tenant {TenantId}", activityMaster.ActivityName, tenantId); + return ApiResponse.SuccessResponse(activityVM, "Activity created successfully", 201); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error occurred while creating activity"); + return ApiResponse.ErrorResponse("An error occurred while creating activity", ex.Message, 500); + } + } + public async Task> UpdateActivity(Guid id, CreateActivityMasterDto createActivity) + { + _logger.LogInfo("UpdateActivity called for ActivityId: {ActivityId}", id); + + try + { + // Step 1: Validate input + if (createActivity == null || string.IsNullOrWhiteSpace(createActivity.ActivityName) || string.IsNullOrWhiteSpace(createActivity.UnitOfMeasurement)) + { + _logger.LogWarning("Invalid activity update input for ActivityId: {ActivityId}", id); + return ApiResponse.ErrorResponse("Invalid input", "ActivityName and UnitOfMeasurement are required", 400); + } + + // Step 2: Check permissions + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + if (!hasPermission) + { + _logger.LogWarning("Access denied for employeeId: {EmployeeId}", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to update activities", 403); + } + + // Step 3: Validate service, activity group, and activity existence + var activityGroup = await _context.ActivityGroupMasters.Include(ag => ag.ServicesMaster).FirstOrDefaultAsync(ag => ag.Id == createActivity.ActitvityGroupId && ag.IsActive); + + if (activityGroup == null || activityGroup.ServiceId != createActivity.ServiceId) + { + _logger.LogWarning("User tries to update activity, but cannot able found activity group or service"); + return ApiResponse.ErrorResponse("Invalid activity group ID or service ID", "Please provide valid activity group ID or service ID to update activity group", 400); + } + + var activity = await _context.ActivityMasters + .Include(a => a.ServicesMaster) + .Include(a => a.ActivityGroupMaster) + .FirstOrDefaultAsync(a => a.Id == id && a.IsActive && a.TenantId == tenantId); + + if (activity == null) + { + _logger.LogWarning("Activity not found for ActivityId: {ActivityId}, TenantId: {TenantId}", id, tenantId); + return ApiResponse.ErrorResponse("Activity not found", "Activity not found", 404); + } + + // Step 4: Update activity core data + activity.ActivityName = createActivity.ActivityName.Trim(); + activity.UnitOfMeasurement = createActivity.UnitOfMeasurement.Trim(); + if (activity.ServiceId == null) + { + activity.ServiceId = createActivity.ServiceId; + } + activity.ActitvityGroupId = createActivity.ActitvityGroupId; + + await _context.SaveChangesAsync(); + + // Step 5: Handle checklist updates + var existingChecklists = await _context.ActivityCheckLists + .AsNoTracking() + .Where(c => c.ActivityId == activity.Id) + .ToListAsync(); + + var updatedChecklistVMs = new List(); + + if (createActivity.CheckList != null && createActivity.CheckList.Any()) + { + var incomingCheckIds = createActivity.CheckList.Where(c => c.Id != null).Select(c => c.Id!.Value).ToHashSet(); + + // Prepare lists + var newChecks = createActivity.CheckList.Where(c => c.Id == null); + var updates = createActivity.CheckList.Where(c => c.Id != null && existingChecklists.Any(ec => ec.Id == c.Id)); + var deletes = existingChecklists.Where(ec => !incomingCheckIds.Contains(ec.Id)).ToList(); + + var toAdd = newChecks + .Select(c => c.ToActivityCheckListFromCreateCheckListDto(tenantId, activity.Id)) + .ToList(); + + var toUpdate = updates + .Select(c => c.ToActivityCheckListFromCreateCheckListDto(tenantId, activity.Id)) + .ToList(); + + _context.ActivityCheckLists.AddRange(toAdd); + _context.ActivityCheckLists.UpdateRange(toUpdate); + _context.ActivityCheckLists.RemoveRange(deletes); + + await _context.SaveChangesAsync(); + + // Prepare view model + updatedChecklistVMs = toAdd.Concat(toUpdate) + .Select(c => c.ToCheckListVMFromActivityCheckList(activity.Id, false)) + .ToList(); + } + else if (existingChecklists.Any()) + { + // If no checklist provided, remove all existing + _context.ActivityCheckLists.RemoveRange(existingChecklists); + await _context.SaveChangesAsync(); + } + + // Step 6: Prepare response + var activityVM = activity.ToActivityVMFromActivityMaster(updatedChecklistVMs, activityGroup.ServicesMaster?.Name, activityGroup.Name); + + _logger.LogInfo("Activity updated successfully. ActivityId: {ActivityId}, TenantId: {TenantId}", activity.Id, tenantId); + return ApiResponse.SuccessResponse(activityVM, "Activity updated successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Exception in UpdateActivity"); + return ApiResponse.ErrorResponse("Error updating activity", ex.Message, 500); + } + } + public async Task> DeleteActivity(Guid id, bool isActive) + { + _logger.LogInfo("DeleteActivity called with ActivityId: {ActivityId}, IsActive: {IsActive}", id, isActive); + + try + { + // Step 1: Validate permission + var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); + var hasPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + + if (!hasPermission) + { + _logger.LogWarning("Access denied for EmployeeId: {EmployeeId}", loggedInEmployee.Id); + return ApiResponse.ErrorResponse("Access denied", "You don't have permission to delete activities", 403); + } + + // Step 2: Fetch the activity + var activity = await _context.ActivityMasters + .FirstOrDefaultAsync(a => a.Id == id && a.TenantId == tenantId); + + if (activity == null) + { + _logger.LogWarning("Activity not found. ActivityId: {ActivityId}", id); + return ApiResponse.ErrorResponse("Activity not found", "Activity not found or already deleted", 404); + } + + // Step 3: Perform soft delete/restore + activity.IsActive = isActive; + await _context.SaveChangesAsync(); + + string status = isActive ? "restored" : "deactivated"; + _logger.LogInfo("Activity {ActivityId} {Status} successfully by EmployeeId: {EmployeeId}", id, status, loggedInEmployee.Id); + + return ApiResponse.SuccessResponse(new { }, $"Activity {status} successfully", 200); + } + catch (Exception ex) + { + _logger.LogError(ex, "Unexpected error while deleting activity {ActivityId}", id); + return ApiResponse.ErrorResponse("Error deleting activity", ex.Message, 500); + } + } + + #endregion + + #region =================================================================== Contact Category APIs =================================================================== public async Task> CreateContactCategory(CreateContactCategoryDto contactCategoryDto) { var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); @@ -258,7 +907,7 @@ namespace Marco.Pms.Services.Helpers var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); // Step 2: Check permission to view master data - bool hasViewPermission = await _permission.HasPermission(PermissionsMaster.ViewMasters, loggedInEmployee.Id); + bool hasViewPermission = await _permissionService.HasPermission(PermissionsMaster.ViewMasters, loggedInEmployee.Id); if (!hasViewPermission) { _logger.LogWarning("Access denied for employeeId: {EmployeeId}", loggedInEmployee.Id); @@ -302,7 +951,7 @@ namespace Marco.Pms.Services.Helpers var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); // Step 2: Check if user has permission to manage master data - var hasManageMasterPermission = await _permission.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + var hasManageMasterPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); if (!hasManageMasterPermission) { _logger.LogWarning("Access denied for employeeId: {EmployeeId}", loggedInEmployee.Id); @@ -357,7 +1006,7 @@ namespace Marco.Pms.Services.Helpers var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); // Step 3: Check permissions - var hasManageMasterPermission = await _permission.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + var hasManageMasterPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); if (!hasManageMasterPermission) { _logger.LogWarning("Access denied. EmployeeId: {EmployeeId} does not have Manage Master permission.", loggedInEmployee.Id); @@ -409,7 +1058,7 @@ namespace Marco.Pms.Services.Helpers var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); // Step 2: Check permission to manage master data - var hasManageMasterPermission = await _permission.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); + var hasManageMasterPermission = await _permissionService.HasPermission(PermissionsMaster.ManageMasters, loggedInEmployee.Id); if (!hasManageMasterPermission) { _logger.LogWarning("Delete denied. EmployeeId: {EmployeeId} lacks Manage_Master permission.", loggedInEmployee.Id);