Document_Manager #129
@ -59,6 +59,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
public DbSet<Module> Modules { get; set; }
|
||||
public DbSet<Feature> Features { get; set; }
|
||||
public DbSet<FeaturePermission> FeaturePermissions { get; set; }
|
||||
public DbSet<ProjectLevelPermissionMapping> ProjectLevelPermissionMappings { get; set; }
|
||||
public DbSet<CurrencyMaster> CurrencyMaster { get; set; }
|
||||
public DbSet<ApplicationRole> ApplicationRoles { get; set; }
|
||||
public DbSet<JobRole> JobRoles { get; set; }
|
||||
@ -773,7 +774,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 2,
|
||||
IsValidationRequired = true,
|
||||
IsMandatory = true,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
@ -788,7 +789,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 2,
|
||||
IsValidationRequired = true,
|
||||
IsMandatory = true,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
@ -803,7 +804,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 2,
|
||||
IsValidationRequired = true,
|
||||
IsMandatory = true,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
@ -818,7 +819,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 2,
|
||||
IsValidationRequired = true,
|
||||
IsMandatory = true,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
@ -833,7 +834,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 2,
|
||||
IsValidationRequired = true,
|
||||
IsMandatory = true,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
@ -848,7 +849,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 1,
|
||||
IsValidationRequired = false,
|
||||
IsMandatory = false,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
@ -862,7 +863,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 1,
|
||||
IsValidationRequired = false,
|
||||
IsMandatory = false,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
@ -876,7 +877,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 1,
|
||||
IsValidationRequired = false,
|
||||
IsMandatory = false,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
@ -890,7 +891,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 1,
|
||||
IsValidationRequired = false,
|
||||
IsMandatory = false,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
@ -904,7 +905,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 1,
|
||||
IsValidationRequired = false,
|
||||
IsMandatory = false,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
@ -918,7 +919,7 @@ namespace Marco.Pms.DataAccess.Data
|
||||
MaxSizeAllowedInMB = 20,
|
||||
IsValidationRequired = false,
|
||||
IsMandatory = false,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc),
|
||||
IsSystem = true,
|
||||
IsActive = true,
|
||||
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
|
5521
Marco.Pms.DataAccess/Migrations/20250903104652_Added_Project_Level_Permssion_Mapping_Table.Designer.cs
generated
Normal file
5521
Marco.Pms.DataAccess/Migrations/20250903104652_Added_Project_Level_Permssion_Mapping_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,264 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Project_Level_Permssion_Mapping_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProjectLevelPermissionMappings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
EmployeeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ProjectId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PermissionId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProjectLevelPermissionMappings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProjectLevelPermissionMappings_Employees_EmployeeId",
|
||||
column: x => x.EmployeeId,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProjectLevelPermissionMappings_FeaturePermissions_Permission~",
|
||||
column: x => x.PermissionId,
|
||||
principalTable: "FeaturePermissions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProjectLevelPermissionMappings_Projects_ProjectId",
|
||||
column: x => x.ProjectId,
|
||||
principalTable: "Projects",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProjectLevelPermissionMappings_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentCategoryMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6233));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentCategoryMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6226));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("07ca7182-9ac0-4407-b988-59901170cb86"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6307));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("16c40b80-c207-4a0c-a4d3-381414afe35a"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6290));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("260abd7e-c96d-4ae4-a29b-9b5bb5d24ebd"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6298));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("2d1d7441-46a8-425e-9395-94d0956f8e91"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6286));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("336225ac-67f3-4e14-ba7a-8fad03cf2832"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6275));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("5668de00-5d84-47f7-b9b5-7fefd1219f05"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6319));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6344393b-9bb1-45f8-b620-9f6e279d012c"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6282));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("7cc41c91-23cb-442b-badd-f932138d149f"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6314));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("846e89a9-5735-45ec-a21d-c97f85a94ada"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6311));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("a1a190ba-c4a8-432f-b26d-1231ca1d44bc"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6302));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("f76d8215-d399-4f0e-b414-12e427f50be3"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6295));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjectLevelPermissionMappings_EmployeeId",
|
||||
table: "ProjectLevelPermissionMappings",
|
||||
column: "EmployeeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjectLevelPermissionMappings_PermissionId",
|
||||
table: "ProjectLevelPermissionMappings",
|
||||
column: "PermissionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjectLevelPermissionMappings_ProjectId",
|
||||
table: "ProjectLevelPermissionMappings",
|
||||
column: "ProjectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProjectLevelPermissionMappings_TenantId",
|
||||
table: "ProjectLevelPermissionMappings",
|
||||
column: "TenantId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProjectLevelPermissionMappings");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentCategoryMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2627));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentCategoryMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2617));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("07ca7182-9ac0-4407-b988-59901170cb86"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2718));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("16c40b80-c207-4a0c-a4d3-381414afe35a"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2700));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("260abd7e-c96d-4ae4-a29b-9b5bb5d24ebd"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2710));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("2d1d7441-46a8-425e-9395-94d0956f8e91"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2695));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("336225ac-67f3-4e14-ba7a-8fad03cf2832"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2684));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("5668de00-5d84-47f7-b9b5-7fefd1219f05"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2731));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6344393b-9bb1-45f8-b620-9f6e279d012c"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2690));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("7cc41c91-23cb-442b-badd-f932138d149f"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2727));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("846e89a9-5735-45ec-a21d-c97f85a94ada"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2722));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("a1a190ba-c4a8-432f-b26d-1231ca1d44bc"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2714));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "DocumentTypeMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("f76d8215-d399-4f0e-b414-12e427f50be3"),
|
||||
column: "CreatedAt",
|
||||
value: new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2705));
|
||||
}
|
||||
}
|
||||
}
|
@ -931,7 +931,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2617),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6226),
|
||||
Description = "Project documents are formal records that outline the plans, progress, and details necessary to execute and manage a project effectively.",
|
||||
EntityTypeId = new Guid("c8fe7115-aa27-43bc-99f4-7b05fabe436e"),
|
||||
Name = "Project Documents",
|
||||
@ -940,7 +940,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2627),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6233),
|
||||
Description = "Employment details along with legal IDs like passports or driver’s licenses to verify identity and work authorization.",
|
||||
EntityTypeId = new Guid("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7"),
|
||||
Name = "Employee Documents",
|
||||
@ -1026,7 +1026,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("336225ac-67f3-4e14-ba7a-8fad03cf2832"),
|
||||
AllowedContentType = "application/pdf,image/jpeg",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2684),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6275),
|
||||
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
IsActive = true,
|
||||
IsMandatory = true,
|
||||
@ -1041,7 +1041,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("6344393b-9bb1-45f8-b620-9f6e279d012c"),
|
||||
AllowedContentType = "application/pdf,image/jpeg",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2690),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6282),
|
||||
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
IsActive = true,
|
||||
IsMandatory = true,
|
||||
@ -1056,7 +1056,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("2d1d7441-46a8-425e-9395-94d0956f8e91"),
|
||||
AllowedContentType = "application/pdf,image/jpeg",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2695),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6286),
|
||||
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
IsActive = true,
|
||||
IsMandatory = true,
|
||||
@ -1071,7 +1071,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("16c40b80-c207-4a0c-a4d3-381414afe35a"),
|
||||
AllowedContentType = "application/pdf,image/jpeg",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2700),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6290),
|
||||
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
IsActive = true,
|
||||
IsMandatory = true,
|
||||
@ -1086,7 +1086,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("f76d8215-d399-4f0e-b414-12e427f50be3"),
|
||||
AllowedContentType = "application/pdf,image/jpeg",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2705),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6295),
|
||||
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
|
||||
IsActive = true,
|
||||
IsMandatory = true,
|
||||
@ -1101,7 +1101,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("260abd7e-c96d-4ae4-a29b-9b5bb5d24ebd"),
|
||||
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2710),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6298),
|
||||
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
IsActive = true,
|
||||
IsMandatory = false,
|
||||
@ -1115,7 +1115,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("a1a190ba-c4a8-432f-b26d-1231ca1d44bc"),
|
||||
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2714),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6302),
|
||||
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
IsActive = true,
|
||||
IsMandatory = false,
|
||||
@ -1129,7 +1129,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("07ca7182-9ac0-4407-b988-59901170cb86"),
|
||||
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2718),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6307),
|
||||
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
IsActive = true,
|
||||
IsMandatory = false,
|
||||
@ -1143,7 +1143,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("846e89a9-5735-45ec-a21d-c97f85a94ada"),
|
||||
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2722),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6311),
|
||||
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
IsActive = true,
|
||||
IsMandatory = false,
|
||||
@ -1157,7 +1157,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("7cc41c91-23cb-442b-badd-f932138d149f"),
|
||||
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2727),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6314),
|
||||
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
IsActive = true,
|
||||
IsMandatory = false,
|
||||
@ -1171,7 +1171,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
Id = new Guid("5668de00-5d84-47f7-b9b5-7fefd1219f05"),
|
||||
AllowedContentType = "application/pdf,image/vnd.dwg,application/acad",
|
||||
CreatedAt = new DateTime(2025, 8, 30, 4, 55, 10, 359, DateTimeKind.Utc).AddTicks(2731),
|
||||
CreatedAt = new DateTime(2025, 9, 3, 10, 46, 49, 955, DateTimeKind.Utc).AddTicks(6319),
|
||||
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
|
||||
IsActive = true,
|
||||
IsMandatory = false,
|
||||
@ -1683,6 +1683,37 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.Entitlements.ProjectLevelPermissionMapping", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("EmployeeId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("PermissionId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("ProjectId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid>("TenantId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EmployeeId");
|
||||
|
||||
b.HasIndex("PermissionId");
|
||||
|
||||
b.HasIndex("ProjectId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("ProjectLevelPermissionMappings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b =>
|
||||
{
|
||||
b.Property<Guid>("ApplicationRoleId")
|
||||
@ -4750,6 +4781,41 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
b.Navigation("Feature");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.Entitlements.ProjectLevelPermissionMapping", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee")
|
||||
.WithMany()
|
||||
.HasForeignKey("EmployeeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", "Permission")
|
||||
.WithMany()
|
||||
.HasForeignKey("PermissionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Projects.Project", "Project")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProjectId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Employee");
|
||||
|
||||
b.Navigation("Permission");
|
||||
|
||||
b.Navigation("Project");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.Roles.ApplicationRole", null)
|
||||
|
@ -4,8 +4,8 @@ namespace Marco.Pms.Model.Dtos.Util
|
||||
{
|
||||
public class ProjctLevelPermissionDto
|
||||
{
|
||||
public Guid EmployeeId { get; set; }
|
||||
public Guid ProjectId { get; set; }
|
||||
public FeaturesPermissionDto? Permission { get; set; }
|
||||
public required Guid EmployeeId { get; set; }
|
||||
public required Guid ProjectId { get; set; }
|
||||
public required List<FeaturesPermissionDto> Permission { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
var response = await _projectServices.ManageProjectLevelPermissionAsync(model, tenantId, loggedInEmployee);
|
||||
return StatusCode(response.StatusCode, response);
|
||||
}
|
||||
[HttpGet("get/project-level-permission/employee/{employeeId}/prject/{projectId}")]
|
||||
[HttpGet("get/project-level-permission/employee/{employeeId}/project/{projectId}")]
|
||||
public async Task<IActionResult> GetAssignedProjectLevelPermission(Guid employeeId, Guid projectId)
|
||||
{
|
||||
Employee loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
|
||||
|
@ -99,6 +99,7 @@ namespace Marco.Pms.Services.MappingProfiles
|
||||
// Your mappings
|
||||
CreateMap<Project, ProjectVM>();
|
||||
CreateMap<Project, ProjectInfoVM>();
|
||||
CreateMap<Project, BasicProjectVM>();
|
||||
CreateMap<ProjectMongoDB, ProjectInfoVM>();
|
||||
CreateMap<UpdateProjectDto, Project>();
|
||||
CreateMap<Project, ProjectListVM>();
|
||||
|
@ -10,7 +10,9 @@ using Marco.Pms.Model.MongoDBModels.Project;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Marco.Pms.Model.TenantModels;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Marco.Pms.Model.ViewModels.Activities;
|
||||
using Marco.Pms.Model.ViewModels.Employee;
|
||||
using Marco.Pms.Model.ViewModels.Master;
|
||||
using Marco.Pms.Model.ViewModels.Projects;
|
||||
using Marco.Pms.Services.Helpers;
|
||||
using Marco.Pms.Services.Service.ServiceInterfaces;
|
||||
@ -1468,29 +1470,172 @@ namespace Marco.Pms.Services.Service
|
||||
#endregion
|
||||
|
||||
#region =================================================================== Project-Level Permission APIs ===================================================================
|
||||
public async Task<ApiResponse<object>> ManageProjectLevelPermissionAsync(ProjctLevelPermissionDto model, Guid tenantId, Employee loggedInEmployee)
|
||||
|
||||
/// <summary>
|
||||
/// Manages project-level permissions for an employee, optimizing DB calls and operations.
|
||||
/// </summary>
|
||||
/// <param name="model">Project-level permission DTO.</param>
|
||||
/// <param name="tenantId">Tenant Guid.</param>
|
||||
/// <param name="loggedInEmployee">Currently logged in employee.</param>
|
||||
/// <returns>API response indicating the result.</returns>
|
||||
public async Task<ApiResponse<object>> ManageProjectLevelPermissionAsync(
|
||||
ProjctLevelPermissionDto model,
|
||||
Guid tenantId,
|
||||
Employee loggedInEmployee
|
||||
)
|
||||
{
|
||||
// Log: Method entry and received parameters
|
||||
_logger.LogInfo("ManageProjectLevelPermissionAsync started for EmployeeId: {EmployeeId}, ProjectId: {ProjectId}, TenantId: {TenantId}",
|
||||
model.EmployeeId, model.ProjectId, tenantId);
|
||||
|
||||
// Fetch all required entities in parallel where possible
|
||||
var featurePermissionIds = model.Permission.Select(p => p.Id).ToList();
|
||||
|
||||
// Log: Starting DB queries
|
||||
_logger.LogDebug("Fetching employee, project, feature permissions, and existing mappings.");
|
||||
|
||||
var employeeTask = Task.Run(async () =>
|
||||
{
|
||||
await using var context = await _dbContextFactory.CreateDbContextAsync();
|
||||
return await context.ProjectAllocations.Include(pa => pa.Employee)
|
||||
.AsNoTracking()
|
||||
.Where(pa => pa.EmployeeId == model.EmployeeId && pa.ProjectId == model.ProjectId && pa.TenantId == tenantId && pa.IsActive)
|
||||
.Select(pa => pa.Employee).FirstOrDefaultAsync();
|
||||
});
|
||||
|
||||
var projectTask = Task.Run(async () =>
|
||||
{
|
||||
await using var context = await _dbContextFactory.CreateDbContextAsync();
|
||||
return await context.Projects.FirstOrDefaultAsync(p => p.Id == model.ProjectId && p.TenantId == tenantId);
|
||||
return await context.Projects.AsNoTracking().FirstOrDefaultAsync(p => p.Id == model.ProjectId && p.TenantId == tenantId);
|
||||
});
|
||||
|
||||
var featurePermissionsTask = Task.Run(async () =>
|
||||
{
|
||||
var featurePermissionIds = model.Permission.Select(p => p.Id).ToList();
|
||||
await using var context = await _dbContextFactory.CreateDbContextAsync();
|
||||
return await context.FeaturePermissions.AsNoTracking().Where(p => featurePermissionIds.Contains(p.Id)).ToListAsync();
|
||||
});
|
||||
return ApiResponse<object>.SuccessResponse("");
|
||||
|
||||
var oldProjectLevelMappingTask = Task.Run(async () =>
|
||||
{
|
||||
await using var context = await _dbContextFactory.CreateDbContextAsync();
|
||||
return await context.ProjectLevelPermissionMappings
|
||||
.AsNoTracking()
|
||||
.Where(p => p.EmployeeId == model.EmployeeId && p.ProjectId == model.ProjectId && p.TenantId == tenantId).ToListAsync();
|
||||
});
|
||||
|
||||
await Task.WhenAll(employeeTask, projectTask, featurePermissionsTask, oldProjectLevelMappingTask);
|
||||
|
||||
var employee = employeeTask.Result;
|
||||
var project = projectTask.Result;
|
||||
var featurePermissions = featurePermissionsTask.Result;
|
||||
var oldProjectLevelMapping = oldProjectLevelMappingTask.Result;
|
||||
|
||||
// Validate all loaded entities
|
||||
if (employee == null)
|
||||
{
|
||||
_logger.LogWarning("Employee not found: {EmployeeId}", model.EmployeeId);
|
||||
return ApiResponse<object>.ErrorResponse("Employee not found", "Employee not found in database", 404);
|
||||
}
|
||||
if (project == null)
|
||||
{
|
||||
_logger.LogWarning("Project not found: {ProjectId}", model.ProjectId);
|
||||
return ApiResponse<object>.ErrorResponse("Project not found", "Project not found in database", 404);
|
||||
}
|
||||
if (!(featurePermissions?.Any() ?? false))
|
||||
{
|
||||
_logger.LogWarning("No feature permissions found for provided ids");
|
||||
return ApiResponse<object>.ErrorResponse("No permission found", "No permission found in database", 404);
|
||||
}
|
||||
_logger.LogDebug("All entities loaded successfully for permission processing.");
|
||||
|
||||
// Permission diff logic: Add new, Remove old
|
||||
var oldProjectLevelPermissionIds = oldProjectLevelMapping.Select(p => p.PermissionId).ToList();
|
||||
|
||||
var newProjectLevelPermissions = model.Permission
|
||||
.Where(p => p.IsEnabled && !oldProjectLevelPermissionIds.Contains(p.Id))
|
||||
.Select(p => new ProjectLevelPermissionMapping
|
||||
{
|
||||
EmployeeId = model.EmployeeId,
|
||||
ProjectId = model.ProjectId,
|
||||
PermissionId = p.Id,
|
||||
TenantId = tenantId
|
||||
}).ToList();
|
||||
|
||||
var deleteProjectLevelPermissions = oldProjectLevelMapping
|
||||
.Where(pl => model.Permission.Any(p => !p.IsEnabled && p.Id == pl.PermissionId))
|
||||
.ToList();
|
||||
|
||||
// Apply permission changes
|
||||
if (newProjectLevelPermissions.Any())
|
||||
{
|
||||
_context.ProjectLevelPermissionMappings.AddRange(newProjectLevelPermissions);
|
||||
_logger.LogInfo("Added {Count} new project-level permissions.", newProjectLevelPermissions.Count);
|
||||
}
|
||||
|
||||
if (deleteProjectLevelPermissions.Any())
|
||||
{
|
||||
_context.ProjectLevelPermissionMappings.RemoveRange(deleteProjectLevelPermissions);
|
||||
_logger.LogInfo("Removed {Count} old project-level permissions.", deleteProjectLevelPermissions.Count);
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
_logger.LogInfo("Project-level permission changes persisted for EmployeeId: {EmployeeId}, ProjectId: {ProjectId}", model.EmployeeId, model.ProjectId);
|
||||
|
||||
// Final permissions for response
|
||||
var permissions = await _context.ProjectLevelPermissionMappings
|
||||
.Include(p => p.Permission)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.EmployeeId == model.EmployeeId && p.ProjectId == model.ProjectId && p.TenantId == tenantId)
|
||||
.Select(p => _mapper.Map<FeaturePermissionVM>(p.Permission))
|
||||
.ToListAsync();
|
||||
|
||||
_logger.LogInfo("ManageProjectLevelPermissionAsync completed successfully.");
|
||||
|
||||
var response = new
|
||||
{
|
||||
EmployeeId = _mapper.Map<BasicEmployeeVM>(employee),
|
||||
ProjectId = _mapper.Map<BasicProjectVM>(project),
|
||||
Permissions = permissions
|
||||
};
|
||||
|
||||
return ApiResponse<object>.SuccessResponse(response, "Project-Level permission assigned successfully", 200);
|
||||
}
|
||||
|
||||
public async Task<ApiResponse<object>> GetAssignedProjectLevelPermissionAsync(Guid employeeId, Guid projectId, Guid tenantId, Employee loggedInEmployee)
|
||||
{
|
||||
return ApiResponse<object>.SuccessResponse("");
|
||||
var projectLevelPermissionMappings = await _context.ProjectLevelPermissionMappings
|
||||
.Include(p => p.Employee)
|
||||
.ThenInclude(e => e!.JobRole)
|
||||
.Include(p => p.Project)
|
||||
.Include(p => p.Permission)
|
||||
.ThenInclude(fp => fp!.Feature)
|
||||
.AsNoTracking()
|
||||
.Where(p => p.EmployeeId == employeeId && p.ProjectId == projectId && p.TenantId == tenantId)
|
||||
.GroupBy(p => p.EmployeeId)
|
||||
.Select(g => new
|
||||
{
|
||||
Employee = g.Select(p => _mapper.Map<BasicEmployeeVM>(p.Employee)).FirstOrDefault(),
|
||||
Project = g.Select(p => _mapper.Map<BasicProjectVM>(p.Project)).FirstOrDefault(),
|
||||
Permissions = g.Select(p => _mapper.Map<FeaturePermissionVM>(p.Permission)).ToList()
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (projectLevelPermissionMappings == null)
|
||||
{
|
||||
return ApiResponse<object>.ErrorResponse("Project-Level Permissions not found", "Project-Level Permissions not found in database", 404);
|
||||
}
|
||||
|
||||
if (projectLevelPermissionMappings.Employee == null)
|
||||
{
|
||||
return ApiResponse<object>.ErrorResponse("Employee not found", "Employee not found in database", 404);
|
||||
}
|
||||
if (projectLevelPermissionMappings.Project == null)
|
||||
{
|
||||
return ApiResponse<object>.ErrorResponse("Project not found", "Project not found in database", 404);
|
||||
}
|
||||
|
||||
return ApiResponse<object>.SuccessResponse(projectLevelPermissionMappings, "Project-Level Permissions fetched successfully", 200);
|
||||
}
|
||||
public async Task<ApiResponse<object>> AssignProjectLevelModulesAsync(Guid tenantId, Employee loggedInEmployee)
|
||||
{
|
||||
@ -1502,8 +1647,24 @@ namespace Marco.Pms.Services.Service
|
||||
Guid.Parse("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"),
|
||||
Guid.Parse("a8cf4331-8f04-4961-8360-a3f7c3cc7462")
|
||||
};
|
||||
var featurePermissions = await _context.FeaturePermissions.Include(fp => fp.Feature).Where(fp => moduleList.Contains(fp.Id) && fp.IsEnabled).ToListAsync();
|
||||
return ApiResponse<object>.SuccessResponse(featurePermissions);
|
||||
|
||||
var features = await _context.Features
|
||||
.Include(f => f.FeaturePermissions)
|
||||
.Include(f => f.Module)
|
||||
.Where(f => moduleList.Contains(f.Id) && f.Module != null)
|
||||
.Select(f => new FeatureVM
|
||||
{
|
||||
Id = f.Id,
|
||||
Name = f.Name,
|
||||
Description = f.Description,
|
||||
FeaturePermissions = _mapper.Map<List<FeaturePermissionVM>>(f.FeaturePermissions),
|
||||
ModuleId = f.ModuleId,
|
||||
ModuleName = f.Module!.Name,
|
||||
IsActive = f.IsActive,
|
||||
ModuleKey = f.Module!.Key
|
||||
}).ToListAsync();
|
||||
|
||||
return ApiResponse<object>.SuccessResponse(features);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user