From e6fb6a23b579b597174828bc870916c40e199ed8 Mon Sep 17 00:00:00 2001 From: Vikas Nale Date: Wed, 2 Apr 2025 18:35:58 +0530 Subject: [PATCH] #40 - Add models and database migration for Task Allocation --- .../Data/ApplicationDbContext.cs | 10 +- ...402124701_TaskAllocationModels.Designer.cs | 2128 +++++++++++++++++ .../20250402124701_TaskAllocationModels.cs | 543 +++++ .../ApplicationDbContextModelSnapshot.cs | 440 ++-- Marco.Pms.Model/Activities/TaskAllocation.cs | 51 +- Marco.Pms.Model/Activities/TaskComment.cs | 30 + Marco.Pms.Model/Activities/TaskImages.cs | 17 + Marco.Pms.Model/Activities/TaskMembers.cs | 33 + .../Dtos/Activities/AssignTaskDto.cs | 6 + Marco.Pms.Model/Dtos/Project/WorkItemVM.cs | 2 +- Marco.Pms.Model/Mapper/ActivitiesMapper.cs | 6 + Marco.Pms.Model/Mapper/InfraMapper.cs | 3 +- .../{Activities => Projects}/WorkItem.cs | 7 +- .../WorkItemMapping.cs | 3 +- .../ViewModels/Activities/AssignedTaskVM.cs | 6 + .../Controllers/ActivityController.cs | 61 - .../Controllers/ProjectController.cs | 1 - .../Controllers/TaskController.cs | 35 +- 18 files changed, 3108 insertions(+), 274 deletions(-) create mode 100644 Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.Designer.cs create mode 100644 Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.cs create mode 100644 Marco.Pms.Model/Activities/TaskComment.cs create mode 100644 Marco.Pms.Model/Activities/TaskImages.cs create mode 100644 Marco.Pms.Model/Activities/TaskMembers.cs create mode 100644 Marco.Pms.Model/Dtos/Activities/AssignTaskDto.cs create mode 100644 Marco.Pms.Model/Mapper/ActivitiesMapper.cs rename Marco.Pms.Model/{Activities => Projects}/WorkItem.cs (83%) rename Marco.Pms.Model/{Activities => Projects}/WorkItemMapping.cs (91%) create mode 100644 Marco.Pms.Model/ViewModels/Activities/AssignedTaskVM.cs delete mode 100644 Marco.Pms.Services/Controllers/ActivityController.cs diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs index 33e6f6f..6dfb48e 100644 --- a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -43,8 +43,16 @@ namespace Marco.Pms.DataAccess.Data public DbSet WorkShifts { get; set; } + + public DbSet TaskAllocations { get; set; } - // public DbSet Attendances { get; set; } + public DbSet TaskComments { get; set; } + public DbSet TaskMembers { get; set; } + + + + + // public DbSet Attendances { get; set; } public DbSet Attendes { get; set; } public DbSet AttendanceLogs { get; set; } diff --git a/Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.Designer.cs new file mode 100644 index 0000000..1ae3e22 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.Designer.cs @@ -0,0 +1,2128 @@ +// +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("20250402124701_TaskAllocationModels")] + partial class TaskAllocationModels + { + /// + 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("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AssignedBy") + .HasColumnType("int"); + + b.Property("AssignmentDate") + .HasColumnType("datetime(6)"); + + b.Property("CompletedTask") + .HasColumnType("double"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PlannedTask") + .HasColumnType("double"); + + b.Property("ReportedDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.Property("WorkItemMappingId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AssignedBy"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkItemId"); + + b.HasIndex("WorkItemMappingId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("int"); + + b.Property("TaskAllocationId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + 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("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("TaskAllocationId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + 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("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + 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("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + 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") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("JoiningDate") + .HasColumnType("datetime(6)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .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 = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + 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.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IndustryId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .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 = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + IndustryId = 1, + IsActive = true, + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Industries.Industry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Industries"); + + b.HasData( + new + { + Id = 1, + Name = "Information Technology (IT) Services" + }, + new + { + Id = 2, + Name = "Manufacturing & Production" + }, + new + { + Id = 3, + Name = "Energy & Resources" + }, + new + { + Id = 4, + Name = "Finance & Professional Services" + }, + new + { + Id = 5, + Name = "Hospitals and Healthcare Services" + }, + new + { + Id = 6, + Name = "Social Services" + }, + new + { + Id = 7, + Name = "Retail & Consumer Services" + }, + new + { + Id = 8, + Name = "Transportation & Logistics" + }, + new + { + Id = 9, + Name = "Education & Training" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + 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("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + 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("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + 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("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + 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("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("AssignedBy") + .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.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItemMapping", "WorkItemMapping") + .WithMany() + .HasForeignKey("WorkItemMappingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + + b.Navigation("WorkItemMapping"); + }); + + 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.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("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.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.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.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.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.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.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", 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.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.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.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.Entitlements.Tenant", b => + { + b.HasOne("Marco.Pms.Model.Industries.Industry", "Industry") + .WithMany() + .HasForeignKey("IndustryId"); + + b.Navigation("Industry"); + }); + + 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.Entitlements.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.Entitlements.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.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItemMapping", b => + { + 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.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + 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.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.cs b/Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.cs new file mode 100644 index 0000000..0762084 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250402124701_TaskAllocationModels.cs @@ -0,0 +1,543 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class TaskAllocationModels : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_ActivityMasters_TaskAllocations_TaskAllocationId", + table: "ActivityMasters"); + + migrationBuilder.DropForeignKey( + name: "FK_TaskAllocations_Buildings_BuildingId", + table: "TaskAllocations"); + + migrationBuilder.DropForeignKey( + name: "FK_TaskAllocations_Employees_EmployeeId", + table: "TaskAllocations"); + + migrationBuilder.DropForeignKey( + name: "FK_TaskAllocations_Projects_ProjectId", + table: "TaskAllocations"); + + migrationBuilder.DropForeignKey( + name: "FK_TaskAllocations_WorkAreas_WorkAreaId", + table: "TaskAllocations"); + + migrationBuilder.DropIndex( + name: "IX_TaskAllocations_BuildingId", + table: "TaskAllocations"); + + migrationBuilder.DropIndex( + name: "IX_TaskAllocations_EmployeeId", + table: "TaskAllocations"); + + migrationBuilder.DropIndex( + name: "IX_ActivityMasters_TaskAllocationId", + table: "ActivityMasters"); + + migrationBuilder.DropColumn( + name: "BuildingId", + table: "TaskAllocations"); + + migrationBuilder.DropColumn( + name: "EmployeeId", + table: "TaskAllocations"); + + migrationBuilder.DropColumn( + name: "TaskAllocationId", + table: "ActivityMasters"); + + migrationBuilder.RenameColumn( + name: "WorkAreaId", + table: "TaskAllocations", + newName: "WorkItemMappingId"); + + migrationBuilder.RenameColumn( + name: "ReAllocationDate", + table: "TaskAllocations", + newName: "ReportedDate"); + + migrationBuilder.RenameColumn( + name: "ProjectId", + table: "TaskAllocations", + newName: "WorkItemId"); + + migrationBuilder.RenameColumn( + name: "EmployeeRole", + table: "TaskAllocations", + newName: "AssignedBy"); + + migrationBuilder.RenameColumn( + name: "AllocationDate", + table: "TaskAllocations", + newName: "AssignmentDate"); + + migrationBuilder.RenameIndex( + name: "IX_TaskAllocations_WorkAreaId", + table: "TaskAllocations", + newName: "IX_TaskAllocations_WorkItemMappingId"); + + migrationBuilder.RenameIndex( + name: "IX_TaskAllocations_ProjectId", + table: "TaskAllocations", + newName: "IX_TaskAllocations_WorkItemId"); + + migrationBuilder.AlterColumn( + name: "PlannedWork", + table: "WorkItems", + type: "double", + nullable: false, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AlterColumn( + name: "CompletedWork", + table: "WorkItems", + type: "double", + nullable: false, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "TaskAllocations", + type: "bigint", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AddColumn( + name: "CompletedTask", + table: "TaskAllocations", + type: "double", + nullable: false, + defaultValue: 0.0); + + migrationBuilder.AddColumn( + name: "Description", + table: "TaskAllocations", + type: "longtext", + nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "PlannedTask", + table: "TaskAllocations", + type: "double", + nullable: false, + defaultValue: 0.0); + + migrationBuilder.CreateTable( + name: "TaskComments", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TaskAllocationId = table.Column(type: "bigint", nullable: false), + CommentDate = table.Column(type: "datetime(6)", nullable: false), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CommentedBy = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskComments", x => x.Id); + table.ForeignKey( + name: "FK_TaskComments_Employees_CommentedBy", + column: x => x.CommentedBy, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskComments_TaskAllocations_TaskAllocationId", + column: x => x.TaskAllocationId, + principalTable: "TaskAllocations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskComments_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "TaskMembers", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + TaskAllocationId = table.Column(type: "bigint", nullable: false), + EmployeeId = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskMembers", x => x.Id); + table.ForeignKey( + name: "FK_TaskMembers_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskMembers_TaskAllocations_TaskAllocationId", + column: x => x.TaskAllocationId, + principalTable: "TaskAllocations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskMembers_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_AssignedBy", + table: "TaskAllocations", + column: "AssignedBy"); + + migrationBuilder.CreateIndex( + name: "IX_TaskComments_CommentedBy", + table: "TaskComments", + column: "CommentedBy"); + + migrationBuilder.CreateIndex( + name: "IX_TaskComments_TaskAllocationId", + table: "TaskComments", + column: "TaskAllocationId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskComments_TenantId", + table: "TaskComments", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskMembers_EmployeeId", + table: "TaskMembers", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskMembers_TaskAllocationId", + table: "TaskMembers", + column: "TaskAllocationId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskMembers_TenantId", + table: "TaskMembers", + column: "TenantId"); + + migrationBuilder.AddForeignKey( + name: "FK_TaskAllocations_Employees_AssignedBy", + table: "TaskAllocations", + column: "AssignedBy", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_TaskAllocations_WorkItemMapping_WorkItemMappingId", + table: "TaskAllocations", + column: "WorkItemMappingId", + principalTable: "WorkItemMapping", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_TaskAllocations_WorkItems_WorkItemId", + table: "TaskAllocations", + column: "WorkItemId", + principalTable: "WorkItems", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_TaskAllocations_Employees_AssignedBy", + table: "TaskAllocations"); + + migrationBuilder.DropForeignKey( + name: "FK_TaskAllocations_WorkItemMapping_WorkItemMappingId", + table: "TaskAllocations"); + + migrationBuilder.DropForeignKey( + name: "FK_TaskAllocations_WorkItems_WorkItemId", + table: "TaskAllocations"); + + migrationBuilder.DropTable( + name: "TaskComments"); + + migrationBuilder.DropTable( + name: "TaskMembers"); + + migrationBuilder.DropIndex( + name: "IX_TaskAllocations_AssignedBy", + table: "TaskAllocations"); + + migrationBuilder.DropColumn( + name: "CompletedTask", + table: "TaskAllocations"); + + migrationBuilder.DropColumn( + name: "Description", + table: "TaskAllocations"); + + migrationBuilder.DropColumn( + name: "PlannedTask", + table: "TaskAllocations"); + + migrationBuilder.RenameColumn( + name: "WorkItemMappingId", + table: "TaskAllocations", + newName: "WorkAreaId"); + + migrationBuilder.RenameColumn( + name: "WorkItemId", + table: "TaskAllocations", + newName: "ProjectId"); + + migrationBuilder.RenameColumn( + name: "ReportedDate", + table: "TaskAllocations", + newName: "ReAllocationDate"); + + migrationBuilder.RenameColumn( + name: "AssignmentDate", + table: "TaskAllocations", + newName: "AllocationDate"); + + migrationBuilder.RenameColumn( + name: "AssignedBy", + table: "TaskAllocations", + newName: "EmployeeRole"); + + migrationBuilder.RenameIndex( + name: "IX_TaskAllocations_WorkItemMappingId", + table: "TaskAllocations", + newName: "IX_TaskAllocations_WorkAreaId"); + + migrationBuilder.RenameIndex( + name: "IX_TaskAllocations_WorkItemId", + table: "TaskAllocations", + newName: "IX_TaskAllocations_ProjectId"); + + migrationBuilder.AlterColumn( + name: "PlannedWork", + table: "WorkItems", + type: "int", + nullable: false, + oldClrType: typeof(double), + oldType: "double"); + + migrationBuilder.AlterColumn( + name: "CompletedWork", + table: "WorkItems", + type: "int", + nullable: false, + oldClrType: typeof(double), + oldType: "double"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "TaskAllocations", + type: "int", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AddColumn( + name: "BuildingId", + table: "TaskAllocations", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "EmployeeId", + table: "TaskAllocations", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "TaskAllocationId", + table: "ActivityMasters", + type: "int", + nullable: true); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 1, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 2, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 3, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 4, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 5, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 6, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 7, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 8, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 9, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 10, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 11, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 12, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 13, + column: "TaskAllocationId", + value: null); + + migrationBuilder.UpdateData( + table: "ActivityMasters", + keyColumn: "Id", + keyValue: 14, + column: "TaskAllocationId", + value: null); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_BuildingId", + table: "TaskAllocations", + column: "BuildingId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_EmployeeId", + table: "TaskAllocations", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityMasters_TaskAllocationId", + table: "ActivityMasters", + column: "TaskAllocationId"); + + migrationBuilder.AddForeignKey( + name: "FK_ActivityMasters_TaskAllocations_TaskAllocationId", + table: "ActivityMasters", + column: "TaskAllocationId", + principalTable: "TaskAllocations", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_TaskAllocations_Buildings_BuildingId", + table: "TaskAllocations", + column: "BuildingId", + principalTable: "Buildings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_TaskAllocations_Employees_EmployeeId", + table: "TaskAllocations", + column: "EmployeeId", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_TaskAllocations_Projects_ProjectId", + table: "TaskAllocations", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_TaskAllocations_WorkAreas_WorkAreaId", + table: "TaskAllocations", + column: "WorkAreaId", + principalTable: "WorkAreas", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs index ad3fb4a..b5f10d4 100644 --- a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1,10 +1,7 @@ // -using System; using Marco.Pms.DataAccess.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable @@ -20,118 +17,118 @@ namespace Marco.Pms.DataAccess.Migrations .HasAnnotation("ProductVersion", "8.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 64); - //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => { - b.Property("Id") + b.Property("Id") .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AssignedBy") .HasColumnType("int"); - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AllocationDate") + b.Property("AssignmentDate") .HasColumnType("datetime(6)"); - b.Property("BuildingId") - .HasColumnType("int"); + b.Property("CompletedTask") + .HasColumnType("double"); - b.Property("EmployeeId") - .HasColumnType("int"); + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); - b.Property("EmployeeRole") - .HasColumnType("int"); + b.Property("PlannedTask") + .HasColumnType("double"); - b.Property("ProjectId") - .HasColumnType("int"); - - b.Property("ReAllocationDate") + b.Property("ReportedDate") .HasColumnType("datetime(6)"); b.Property("TenantId") .HasColumnType("int"); - b.Property("WorkAreaId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("BuildingId"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.ToTable("TaskAllocations"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ActivityId") - .HasColumnType("int"); - - b.Property("CompletedWork") - .HasColumnType("int"); - - b.Property("PlannedWork") - .HasColumnType("int"); - - b.Property("TaskDate") - .HasColumnType("datetime(6)"); - - b.Property("TenantId") - .HasColumnType("int"); - - b.Property("WorkAreaId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ActivityId"); - - b.HasIndex("TenantId"); - - b.HasIndex("WorkAreaId"); - - b.ToTable("WorkItems"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("TenantId") - .HasColumnType("int"); - - b.Property("WorkAreaId") - .HasColumnType("int"); - b.Property("WorkItemId") .HasColumnType("int"); + b.Property("WorkItemMappingId") + .HasColumnType("int"); + b.HasKey("Id"); + b.HasIndex("AssignedBy"); + b.HasIndex("TenantId"); - b.HasIndex("WorkAreaId"); - b.HasIndex("WorkItemId"); - b.ToTable("WorkItemMapping"); + b.HasIndex("WorkItemMappingId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CommentDate") + .HasColumnType("datetime(6)"); + + b.Property("CommentedBy") + .HasColumnType("int"); + + b.Property("TaskAllocationId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + 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("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("TaskAllocationId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("TaskMembers"); }); modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => @@ -405,9 +402,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("TaskAllocationId") - .HasColumnType("int"); - b.Property("TenantId") .HasColumnType("int"); @@ -417,8 +411,6 @@ namespace Marco.Pms.DataAccess.Migrations b.HasKey("Id"); - b.HasIndex("TaskAllocationId"); - b.HasIndex("TenantId"); b.ToTable("ActivityMasters"); @@ -1333,6 +1325,71 @@ namespace Marco.Pms.DataAccess.Migrations b.ToTable("WorkAreas"); }); + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("double"); + + b.Property("PlannedWork") + .HasColumnType("double"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property("Id") @@ -1556,21 +1613,77 @@ namespace Marco.Pms.DataAccess.Migrations modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => { - b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") .WithMany() - .HasForeignKey("BuildingId") + .HasForeignKey("AssignedBy") .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.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkItemMapping", "WorkItemMapping") + .WithMany() + .HasForeignKey("WorkItemMappingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("WorkItem"); + + b.Navigation("WorkItemMapping"); + }); + + 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.Projects.Project", "Project") + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", "TaskAllocation") .WithMany() - .HasForeignKey("ProjectId") + .HasForeignKey("TaskAllocationId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1580,75 +1693,11 @@ namespace Marco.Pms.DataAccess.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") - .WithMany() - .HasForeignKey("WorkAreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Building"); - b.Navigation("Employee"); - b.Navigation("Project"); + b.Navigation("TaskAllocation"); b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => - { - b.HasOne("Marco.Pms.Model.Entitlements.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.Navigation("ActivityMaster"); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - }); - - modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => - { - 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.Activities.WorkItem", "WorkItem") - .WithMany() - .HasForeignKey("WorkItemId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tenant"); - - b.Navigation("WorkArea"); - - b.Navigation("WorkItem"); }); modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => @@ -1750,10 +1799,6 @@ namespace Marco.Pms.DataAccess.Migrations modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => { - b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) - .WithMany("AllotedTask") - .HasForeignKey("TaskAllocationId"); - b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") .WithMany() .HasForeignKey("TenantId") @@ -1962,6 +2007,60 @@ namespace Marco.Pms.DataAccess.Migrations b.Navigation("Tenant"); }); + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.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.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkItemMapping", b => + { + 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.Projects.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) @@ -2013,11 +2112,6 @@ namespace Marco.Pms.DataAccess.Migrations .IsRequired(); }); - modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => - { - b.Navigation("AllotedTask"); - }); - modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => { b.Navigation("FeaturePermissions"); diff --git a/Marco.Pms.Model/Activities/TaskAllocation.cs b/Marco.Pms.Model/Activities/TaskAllocation.cs index 6c99950..d3eaab5 100644 --- a/Marco.Pms.Model/Activities/TaskAllocation.cs +++ b/Marco.Pms.Model/Activities/TaskAllocation.cs @@ -11,42 +11,37 @@ namespace Marco.Pms.Model.Activities { public class TaskAllocation { - public int Id { get; set; } - public int EmployeeId { get; set; } - [ForeignKey("EmployeeId")] + public long Id { get; set; } + + + public DateTime AssignmentDate { get; set; } + public double PlannedTask { get; set; } + public double CompletedTask { get; set; } + + + public DateTime ReportedDate { get; set; } + + public string Description { get; set; } + + public int WorkItemMappingId { get; set; } + [ForeignKey("WorkItemMappingId")] + [ValidateNever] + public WorkItemMapping WorkItemMapping { get; set; } + + public int AssignedBy { get; set; } + [ForeignKey("AssignedBy")] [ValidateNever] public Employee Employee { get; set; } - public EMP_ROLES EmployeeRole { get; set; } - public int ProjectId { get; set; } - [ForeignKey("ProjectId")] + public int WorkItemId { get; set; } + [ForeignKey("WorkItemId")] [ValidateNever] - public Project Project { get; set; } + public WorkItem WorkItem { get; set; } - public int BuildingId { get; set; } - - [ForeignKey("BuildingId")] - [ValidateNever] - public Building Building { get; set; } - - public DateTime AllocationDate { get; set; } - public DateTime ReAllocationDate { get; set; } - - public int WorkAreaId { get; set; } - - [ForeignKey("WorkAreaId")] - [ValidateNever] - public WorkArea WorkArea { get; set; } - - public List AllotedTask { get; set; } - - [DisplayName("TenantId")] public int TenantId { get; set; } [ValidateNever] [ForeignKey(nameof(TenantId))] - public Tenant Tenant { get; set; } - - + public Tenant Tenant { get; set; } } } diff --git a/Marco.Pms.Model/Activities/TaskComment.cs b/Marco.Pms.Model/Activities/TaskComment.cs new file mode 100644 index 0000000..369d343 --- /dev/null +++ b/Marco.Pms.Model/Activities/TaskComment.cs @@ -0,0 +1,30 @@ +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Activities +{ + public class TaskComment + { + public long Id { get; set; } + + public long TaskAllocationId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TaskAllocationId))] + public TaskAllocation TaskAllocation { get; set; } + + public DateTime CommentDate { get; set; } + public string Comment { get; set; } + public int CommentedBy { get; set; } + [ForeignKey("CommentedBy")] + [ValidateNever] + public Employee Employee { get; set; } + + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Activities/TaskImages.cs b/Marco.Pms.Model/Activities/TaskImages.cs new file mode 100644 index 0000000..1cd93a2 --- /dev/null +++ b/Marco.Pms.Model/Activities/TaskImages.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Activities +{ + public class TaskImages + { + public long Id { get; set; } + + public long TaskAllocationId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TaskAllocationId))] + public TaskAllocation TaskAllocation { get; set; } + + public string ImagePath { get; set; } + } +} diff --git a/Marco.Pms.Model/Activities/TaskMembers.cs b/Marco.Pms.Model/Activities/TaskMembers.cs new file mode 100644 index 0000000..390ed1a --- /dev/null +++ b/Marco.Pms.Model/Activities/TaskMembers.cs @@ -0,0 +1,33 @@ +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Activities +{ + public class TaskMembers + { + public long Id { get; set; } + + public long TaskAllocationId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TaskAllocationId))] + public TaskAllocation TaskAllocation { get; set; } + + public int EmployeeId { get; set; } + [ForeignKey("EmployeeId")] + [ValidateNever] + public Employee Employee { get; set; } + + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Activities/AssignTaskDto.cs b/Marco.Pms.Model/Dtos/Activities/AssignTaskDto.cs new file mode 100644 index 0000000..149b76d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Activities/AssignTaskDto.cs @@ -0,0 +1,6 @@ +namespace Marco.Pms.Model.Dtos.Activities +{ + public class AssignTaskDto + { + } +} diff --git a/Marco.Pms.Model/Dtos/Project/WorkItemVM.cs b/Marco.Pms.Model/Dtos/Project/WorkItemVM.cs index ae3c7fc..1396190 100644 --- a/Marco.Pms.Model/Dtos/Project/WorkItemVM.cs +++ b/Marco.Pms.Model/Dtos/Project/WorkItemVM.cs @@ -1,4 +1,4 @@ -using Marco.Pms.Model.Activities; +using Marco.Pms.Model.Projects; namespace Marco.Pms.Model.Dtos.Project { diff --git a/Marco.Pms.Model/Mapper/ActivitiesMapper.cs b/Marco.Pms.Model/Mapper/ActivitiesMapper.cs new file mode 100644 index 0000000..8f1eb56 --- /dev/null +++ b/Marco.Pms.Model/Mapper/ActivitiesMapper.cs @@ -0,0 +1,6 @@ +namespace Marco.Pms.Model.Mapper +{ + public class ActivitiesMapper + { + } +} diff --git a/Marco.Pms.Model/Mapper/InfraMapper.cs b/Marco.Pms.Model/Mapper/InfraMapper.cs index 247babd..015d181 100644 --- a/Marco.Pms.Model/Mapper/InfraMapper.cs +++ b/Marco.Pms.Model/Mapper/InfraMapper.cs @@ -1,5 +1,4 @@ -using Marco.Pms.Model.Activities; -using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Dtos.Project; using Marco.Pms.Model.Projects; using System; using System.Collections.Generic; diff --git a/Marco.Pms.Model/Activities/WorkItem.cs b/Marco.Pms.Model/Projects/WorkItem.cs similarity index 83% rename from Marco.Pms.Model/Activities/WorkItem.cs rename to Marco.Pms.Model/Projects/WorkItem.cs index 8c5738c..058a258 100644 --- a/Marco.Pms.Model/Activities/WorkItem.cs +++ b/Marco.Pms.Model/Projects/WorkItem.cs @@ -1,10 +1,9 @@ using Marco.Pms.Model.Entitlements; -using Marco.Pms.Model.Projects; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using System.ComponentModel; using System.ComponentModel.DataAnnotations.Schema; -namespace Marco.Pms.Model.Activities +namespace Marco.Pms.Model.Projects { public class WorkItem { @@ -21,8 +20,8 @@ namespace Marco.Pms.Model.Activities [ValidateNever] public ActivityMaster ActivityMaster { get; set; } - public int PlannedWork { get; set; } - public int CompletedWork { get; set; } + public double PlannedWork { get; set; } + public double CompletedWork { get; set; } public DateTime TaskDate { get; set; } [DisplayName("TenantId")] diff --git a/Marco.Pms.Model/Activities/WorkItemMapping.cs b/Marco.Pms.Model/Projects/WorkItemMapping.cs similarity index 91% rename from Marco.Pms.Model/Activities/WorkItemMapping.cs rename to Marco.Pms.Model/Projects/WorkItemMapping.cs index 8cee2eb..a56a009 100644 --- a/Marco.Pms.Model/Activities/WorkItemMapping.cs +++ b/Marco.Pms.Model/Projects/WorkItemMapping.cs @@ -1,10 +1,9 @@ using Marco.Pms.Model.Entitlements; -using Marco.Pms.Model.Projects; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using System.ComponentModel; using System.ComponentModel.DataAnnotations.Schema; -namespace Marco.Pms.Model.Activities +namespace Marco.Pms.Model.Projects { public class WorkItemMapping { diff --git a/Marco.Pms.Model/ViewModels/Activities/AssignedTaskVM.cs b/Marco.Pms.Model/ViewModels/Activities/AssignedTaskVM.cs new file mode 100644 index 0000000..3d3ffee --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Activities/AssignedTaskVM.cs @@ -0,0 +1,6 @@ +namespace Marco.Pms.Model.ViewModels.Activities +{ + public class AssignedTaskVM + { + } +} diff --git a/Marco.Pms.Services/Controllers/ActivityController.cs b/Marco.Pms.Services/Controllers/ActivityController.cs deleted file mode 100644 index cab04af..0000000 --- a/Marco.Pms.Services/Controllers/ActivityController.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Entitlements; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; - -namespace ModelServices.Controllers -{ - - [Route("api/[controller]")] - [ApiController] - [Authorize] - public class ActivityController : ControllerBase - { - private readonly ApplicationDbContext _context; - private ApplicationUser _applicationUser; - private readonly UserManager _userManager; - - - public ActivityController(UserManager userManager, ApplicationDbContext context) - { - _context = context; - _userManager = userManager; - } - - //[HttpPost("checkin")] - //public async Task CheckIn(int employeeId, string latitude, string longitude) - //{ - // var now = DateTime.UtcNow; - // var date = now.Date; - - // var attendanceLog = new AttendanceLog - // { - // EmployeeID = employeeId, - // //InTime = now, - // Latitude = latitude, - // Longitude = longitude - // }; - // _context.AttendanceLogs.Add(attendanceLog); - - // var attendance = await _context.Attendances - // .FirstOrDefaultAsync(a => a.EmployeeID == employeeId && a.Date == date); - - // if (attendance == null) - // { - // attendance = new Attendance - // { - // EmployeeID = employeeId, - // Date = date, - // InTimeLog = attendanceLog - // }; - // _context.Attendances.Add(attendance); - // } - - - - // await _context.SaveChangesAsync(); - // return Ok(new { Message = "Check-in recorded." }); - //} - } -} diff --git a/Marco.Pms.Services/Controllers/ProjectController.cs b/Marco.Pms.Services/Controllers/ProjectController.cs index 4ca7a23..9749ed4 100644 --- a/Marco.Pms.Services/Controllers/ProjectController.cs +++ b/Marco.Pms.Services/Controllers/ProjectController.cs @@ -1,5 +1,4 @@ using Marco.Pms.DataAccess.Data; -using Marco.Pms.Model.Activities; using Marco.Pms.Model.Dtos.Project; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; diff --git a/Marco.Pms.Services/Controllers/TaskController.cs b/Marco.Pms.Services/Controllers/TaskController.cs index 3066f9f..88a1d75 100644 --- a/Marco.Pms.Services/Controllers/TaskController.cs +++ b/Marco.Pms.Services/Controllers/TaskController.cs @@ -23,11 +23,44 @@ namespace MarcoBMS.Services.Controllers [HttpGet] [Route("activities")] - public async Task GetActivities() + public async Task GetActivitiesMaster() { var activities = await _context.ActivityMasters.Where(c => c.TenantId == _userHelper.GetTenantId()).ToListAsync(); return Ok(activities); } + + + + [HttpPost("assign")] + public ActionResult AssignTask() + { + return Ok(); + } + + + [HttpPost("report")] + public ActionResult ReportTaskProgress() + { + return Ok(); + } + + [HttpPost("comment")] + public ActionResult AddCommentForTask() + { + return Ok(); + } + + [HttpPost("list")] + public ActionResult GetTasksList() + { + return Ok(); + } + + [HttpPost("get/{taskId}")] + public ActionResult GetTask() + { + return Ok(); + } } }