Directory_Refactor #128
5
.gitignore
vendored
5
.gitignore
vendored
@ -360,4 +360,7 @@ MigrationBackup/
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
|
||||
# Sonar
|
||||
/.sonarqube
|
File diff suppressed because one or more lines are too long
@ -1274,7 +1274,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1295,7 +1295,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
columns: new[] { "Id", "ColorCode", "Description", "IsDefault", "Name", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), "#6c757d", "These issues are currently under review", true, "In Review", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"), "#8592a3", "These issues are currently under review", true, "In Review", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("6b0c409b-3e80-4165-8b39-f3fcacb4c797"), "#FFCC99", "This is a newly created issue.", true, "New", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("6c5ac37d-5b7d-40f3-adec-2dabaa5cca86"), "#E6FF99", "Assigned to employee or team of employees", true, "Assigned", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("7f96bcd5-0c66-411b-8a1d-9d1a4785194e"), "#99E6FF", "These issues are currently in progress", true, "In Progress", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
|
@ -1216,7 +1216,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1222,7 +1222,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1299,7 +1299,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1299,7 +1299,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1267,7 +1267,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1602,7 +1602,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1626,7 +1626,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1593,7 +1593,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1633,7 +1633,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1358,7 +1358,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1366,7 +1366,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1425,7 +1425,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1425,7 +1425,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1428,7 +1428,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1428,7 +1428,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
@ -1811,7 +1811,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
3375
Marco.Pms.DataAccess/Migrations/20250616064217_Added_Apporved_By_In_TaskAllocation_Table.Designer.cs
generated
Normal file
3375
Marco.Pms.DataAccess/Migrations/20250616064217_Added_Apporved_By_In_TaskAllocation_Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Apporved_By_In_TaskAllocation_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ApprovedById",
|
||||
table: "TaskAllocations",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ApprovedDate",
|
||||
table: "TaskAllocations",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ParentTaskId",
|
||||
table: "TaskAllocations",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ReportedById",
|
||||
table: "TaskAllocations",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "ReportedTask",
|
||||
table: "TaskAllocations",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "WorkStatusId",
|
||||
table: "TaskAllocations",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "WorkStatusMasters",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsSystem = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_WorkStatusMasters", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_WorkStatusMasters_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "WorkStatusMasters",
|
||||
columns: new[] { "Id", "Description", "IsSystem", "Name", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("00a062e6-62e6-42c5-b6b1-024328651b72"), "Tasks are not finished as reported or have any issues in al the tasks", true, "NCR", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("030bb085-e230-4370-aec7-9a74d652864e"), "Confirm the tasks are actually finished as reported", true, "Approve", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("2a1a5b96-cf93-4111-b4b1-76c19d6333b4"), "Not all tasks are actually finished as reported", true, "Partially Approve", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskAllocations_ApprovedById",
|
||||
table: "TaskAllocations",
|
||||
column: "ApprovedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskAllocations_ReportedById",
|
||||
table: "TaskAllocations",
|
||||
column: "ReportedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TaskAllocations_WorkStatusId",
|
||||
table: "TaskAllocations",
|
||||
column: "WorkStatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_WorkStatusMasters_TenantId",
|
||||
table: "WorkStatusMasters",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TaskAllocations_Employees_ApprovedById",
|
||||
table: "TaskAllocations",
|
||||
column: "ApprovedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TaskAllocations_Employees_ReportedById",
|
||||
table: "TaskAllocations",
|
||||
column: "ReportedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TaskAllocations_WorkStatusMasters_WorkStatusId",
|
||||
table: "TaskAllocations",
|
||||
column: "WorkStatusId",
|
||||
principalTable: "WorkStatusMasters",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TaskAllocations_Employees_ApprovedById",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TaskAllocations_Employees_ReportedById",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TaskAllocations_WorkStatusMasters_WorkStatusId",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "WorkStatusMasters");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TaskAllocations_ApprovedById",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TaskAllocations_ReportedById",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TaskAllocations_WorkStatusId",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ApprovedById",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ApprovedDate",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ParentTaskId",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReportedById",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReportedTask",
|
||||
table: "TaskAllocations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WorkStatusId",
|
||||
table: "TaskAllocations");
|
||||
}
|
||||
}
|
||||
}
|
3381
Marco.Pms.DataAccess/Migrations/20250618112021_EnhancedWorkItemForParentId_Description.Designer.cs
generated
Normal file
3381
Marco.Pms.DataAccess/Migrations/20250618112021_EnhancedWorkItemForParentId_Description.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EnhancedWorkItemForParentId_Description : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Description",
|
||||
table: "WorkItems",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ParentTaskId",
|
||||
table: "WorkItems",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Description",
|
||||
table: "WorkItems");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ParentTaskId",
|
||||
table: "WorkItems");
|
||||
}
|
||||
}
|
||||
}
|
@ -1817,7 +1817,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("5c72b630-6923-4215-bf2c-b1622afd76e7"),
|
||||
ColorCode = "#6c757d",
|
||||
ColorCode = "#8592a3",
|
||||
Description = "These issues are currently under review",
|
||||
IsDefault = true,
|
||||
Name = "In Review",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_UpdatedBy_In_Contacts_And_ContactNotes_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdatedAt",
|
||||
table: "Contacts",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UpdatedById",
|
||||
table: "Contacts",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdatedAt",
|
||||
table: "ContactNotes",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UpdatedById",
|
||||
table: "ContactNotes",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Contacts_UpdatedById",
|
||||
table: "Contacts",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ContactNotes_UpdatedById",
|
||||
table: "ContactNotes",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ContactNotes_Employees_UpdatedById",
|
||||
table: "ContactNotes",
|
||||
column: "UpdatedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Contacts_Employees_UpdatedById",
|
||||
table: "Contacts",
|
||||
column: "UpdatedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ContactNotes_Employees_UpdatedById",
|
||||
table: "ContactNotes");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Contacts_Employees_UpdatedById",
|
||||
table: "Contacts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Contacts_UpdatedById",
|
||||
table: "Contacts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ContactNotes_UpdatedById",
|
||||
table: "ContactNotes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedAt",
|
||||
table: "Contacts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedById",
|
||||
table: "Contacts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedAt",
|
||||
table: "ContactNotes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedById",
|
||||
table: "ContactNotes");
|
||||
}
|
||||
}
|
||||
}
|
3415
Marco.Pms.DataAccess/Migrations/20250630073319_Added_New_Feature_Permissiom_View_All_Employee.Designer.cs
generated
Normal file
3415
Marco.Pms.DataAccess/Migrations/20250630073319_Added_New_Feature_Permissiom_View_All_Employee.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_New_Feature_Permissiom_View_All_Employee : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("f2aee20a-b754-4537-8166-f9507b44585b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
|
||||
column: "Description",
|
||||
value: "Grants a user read-only access to details about the individuals within the system which are is assigned to same projects as user. This typically includes names, contact information, roles, departments, and potentially other relevant employee data");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "FeaturePermissions",
|
||||
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"), "Grants a user read-only access to details about the all individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "View All Employee" },
|
||||
{ new Guid("8d7cc6e3-9147-41f7-aaa7-fa507e450bd4"), "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "View Project Infra" },
|
||||
{ new Guid("cf2825ad-453b-46aa-91d9-27c124d63373"), "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Project Infra" }
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"),
|
||||
column: "Name",
|
||||
value: "Attendance Management");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"),
|
||||
column: "Name",
|
||||
value: "Project Management");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"),
|
||||
column: "Name",
|
||||
value: "Masters");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("8d7cc6e3-9147-41f7-aaa7-fa507e450bd4"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("cf2825ad-453b-46aa-91d9-27c124d63373"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
|
||||
column: "Description",
|
||||
value: "Grants a user read-only access to details about the individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"),
|
||||
column: "Name",
|
||||
value: "Attendance");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"),
|
||||
column: "Name",
|
||||
value: "Manage Project");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"),
|
||||
column: "Name",
|
||||
value: "Global Masters");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Features",
|
||||
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
|
||||
values: new object[] { new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), "Manage Infra", true, new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), "Manage Infra" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "FeaturePermissions",
|
||||
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), "Grants a user comprehensive read-only access to all details concerning the project's underlying systems, technologies, resources, and configurations", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "View Project Infra" },
|
||||
{ new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), "This allows them to create, modify, and manage all aspects of the supporting infrastructure.", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "Manage Project Infra" }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Changed_Name_Of_Feature_Permission_To_ViewTeamMembers : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"),
|
||||
column: "Name",
|
||||
value: "View All Employees");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
|
||||
column: "Name",
|
||||
value: "View Team Members");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"),
|
||||
column: "Name",
|
||||
value: "View All Employee");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
|
||||
column: "Name",
|
||||
value: "View Employee");
|
||||
}
|
||||
}
|
||||
}
|
3426
Marco.Pms.DataAccess/Migrations/20250702042830_Added_UploadedBy_ForeginKey_In_Decuments_Table.Designer.cs
generated
Normal file
3426
Marco.Pms.DataAccess/Migrations/20250702042830_Added_UploadedBy_ForeginKey_In_Decuments_Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_UploadedBy_ForeginKey_In_Decuments_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UploadedById",
|
||||
table: "Documents",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Documents_UploadedById",
|
||||
table: "Documents",
|
||||
column: "UploadedById");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Documents_Employees_UploadedById",
|
||||
table: "Documents",
|
||||
column: "UploadedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Documents_Employees_UploadedById",
|
||||
table: "Documents");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Documents_UploadedById",
|
||||
table: "Documents");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UploadedById",
|
||||
table: "Documents");
|
||||
}
|
||||
}
|
||||
}
|
3419
Marco.Pms.DataAccess/Migrations/20250702045931_Added_Designation_Paraneter_In_Contacts_Table.Designer.cs
generated
Normal file
3419
Marco.Pms.DataAccess/Migrations/20250702045931_Added_Designation_Paraneter_In_Contacts_Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Designation_Paraneter_In_Contacts_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Designation",
|
||||
table: "Contacts",
|
||||
type: "longtext",
|
||||
nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Designation",
|
||||
table: "Contacts");
|
||||
}
|
||||
}
|
||||
}
|
4345
Marco.Pms.DataAccess/Migrations/20250721124928_Added_Expense_Related_Tables.Designer.cs
generated
Normal file
4345
Marco.Pms.DataAccess/Migrations/20250721124928_Added_Expense_Related_Tables.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,664 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Expense_Related_Tables : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ExpensesReimburse",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ReimburseTransactionId = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ReimburseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
ReimburseById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ReimburseNote = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ExpensesReimburse", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesReimburse_Employees_ReimburseById",
|
||||
column: x => x.ReimburseById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesReimburse_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ExpensesStatusMaster",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DisplayName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Color = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsSystem = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ExpensesStatusMaster", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesStatusMaster_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ExpensesTypeMaster",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
NoOfPersonsRequired = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ExpensesTypeMaster", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesTypeMaster_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PaymentModeMatser",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PaymentModeMatser", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PaymentModeMatser_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ExpensesStatusMapping",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
StatusId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
NextStatusId = 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_ExpensesStatusMapping", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesStatusMapping_ExpensesStatusMaster_NextStatusId",
|
||||
column: x => x.NextStatusId,
|
||||
principalTable: "ExpensesStatusMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesStatusMapping_ExpensesStatusMaster_StatusId",
|
||||
column: x => x.StatusId,
|
||||
principalTable: "ExpensesStatusMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesStatusMapping_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "StatusPermissionMapping",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
StatusId = 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_StatusPermissionMapping", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_StatusPermissionMapping_ExpensesStatusMaster_StatusId",
|
||||
column: x => x.StatusId,
|
||||
principalTable: "ExpensesStatusMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_StatusPermissionMapping_FeaturePermissions_PermissionId",
|
||||
column: x => x.PermissionId,
|
||||
principalTable: "FeaturePermissions",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_StatusPermissionMapping_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Expenses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = 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"),
|
||||
ExpensesTypeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PaymentModeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PaidById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TransactionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
TransactionId = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Location = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
GSTNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplerName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Amount = table.Column<double>(type: "double", nullable: false),
|
||||
NoOfPersons = table.Column<int>(type: "int", nullable: true),
|
||||
StatusId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PreApproved = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Expenses", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Expenses_Employees_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Expenses_Employees_PaidById",
|
||||
column: x => x.PaidById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Expenses_ExpensesStatusMaster_StatusId",
|
||||
column: x => x.StatusId,
|
||||
principalTable: "ExpensesStatusMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Expenses_ExpensesTypeMaster_ExpensesTypeId",
|
||||
column: x => x.ExpensesTypeId,
|
||||
principalTable: "ExpensesTypeMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Expenses_PaymentModeMatser_PaymentModeId",
|
||||
column: x => x.PaymentModeId,
|
||||
principalTable: "PaymentModeMatser",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Expenses_Projects_ProjectId",
|
||||
column: x => x.ProjectId,
|
||||
principalTable: "Projects",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Expenses_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BillAttachments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ExpensesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
DocumentId = 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_BillAttachments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BillAttachments_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BillAttachments_Expenses_ExpensesId",
|
||||
column: x => x.ExpensesId,
|
||||
principalTable: "Expenses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BillAttachments_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ExpenseLogs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ExpenseId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Action = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Comment = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ExpenseLogs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpenseLogs_Employees_UpdatedById",
|
||||
column: x => x.UpdatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpenseLogs_Expenses_ExpenseId",
|
||||
column: x => x.ExpenseId,
|
||||
principalTable: "Expenses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpenseLogs_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ExpensesReimburseMapping",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ExpensesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
ExpensesReimburseId = 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_ExpensesReimburseMapping", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesReimburseMapping_ExpensesReimburse_ExpensesReimburse~",
|
||||
column: x => x.ExpensesReimburseId,
|
||||
principalTable: "ExpensesReimburse",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesReimburseMapping_Expenses_ExpensesId",
|
||||
column: x => x.ExpensesId,
|
||||
principalTable: "Expenses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_ExpensesReimburseMapping_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ExpensesStatusMaster",
|
||||
columns: new[] { "Id", "Color", "Description", "DisplayName", "IsActive", "IsSystem", "Name", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8"), "#8592a3", "Expense has been created but not yet submitted.", "Draft", true, true, "Draft", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), "#03c3ec", "Review is completed, waiting for action of approver.", "Mark as Reviewed", true, true, "Approval Pending", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("61578360-3a49-4c34-8604-7b35a3787b95"), "#71dd37", "Expense has been settled.", "Mark as Paid", true, true, "Paid", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), "#696cff", "Reviewer is currently reviewing the expense.", "Submit", true, true, "Review Pending", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), "#ff3e1d", "Expense was declined, often with a reason(either review rejected or approval rejected.", "Reject", true, true, "Rejected", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), "#ffab00", "Approved expense is awaiting final payment.", "Mark as Approved", true, true, "Payment Pending", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ExpensesTypeMaster",
|
||||
columns: new[] { "Id", "Description", "IsActive", "Name", "NoOfPersonsRequired", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("1e2d697a-76b4-4be8-bc66-87144561a1a0"), "Scheduled payments for external services or goods.", true, "Vendor/Supplier Payments", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("2de53163-0dbd-404b-8e60-1b02e6b4886a"), "Vehicle fuel, logistics services and delivery of goods or personnel.", true, "Transport", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("4842fa61-64eb-4241-aebd-8282065af9f9"), "Government fees, insurance, inspections and safety-related expenditures.", true, "Compliance & Safety", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("52484820-1b54-4865-8f0f-baa2b1d339b9"), "Site setup costs including equipment deployment and temporary infrastructure.", true, "Mobilization", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("5e0c6227-d49d-41ff-9f1f-781f0aee2469"), "Materials, equipment and supplies purchased for site operations.", true, "Procurement", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("77013784-9324-4d8b-bd36-d6f928e68942"), "Machinery servicing, electricity, water, and temporary office needs.", true, "Maintenance & Utilities", false, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("dd120bc4-ab0a-45ba-8450-5cd45ff221ca"), "Delivery of personnel.", true, "Travelling", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("fc59eb90-98ea-481c-b421-54bfa9e42d8f"), " Worker amenities like snacks, meals, safety gear, accommodation, medical support etc.", true, "Employee Welfare", true, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Features",
|
||||
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
|
||||
values: new object[] { new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), "Expense Management is the systematic process of tracking, controlling, and reporting business-related expenditures.", true, new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), "Expense Management" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "PaymentModeMatser",
|
||||
columns: new[] { "Id", "Description", "IsActive", "Name", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("24e6b0df-7929-47d2-88a3-4cf14c1f28f9"), "Physical currency; still used for small or informal transactions.", true, "Cash", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("2e919e94-694c-41d9-9489-0a2b4208a027"), "Real-time bank-to-bank transfer using mobile apps; widely used for peer-to-peer and merchant payments.", true, "UPI", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("48d9b462-5d87-4dec-8dec-2bc943943172"), "Paper-based payment order; less common now due to processing delays and fraud risks.", true, "Cheque", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("ed667353-8eea-4fd1-8750-719405932480"), "Online banking portals used to transfer funds directly between accounts", true, "NetBanking", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ExpensesStatusMapping",
|
||||
columns: new[] { "Id", "NextStatusId", "StatusId", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("1fca1700-1266-477d-bba4-9ac3753aa33c"), new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("36c00548-241c-43ec-bc95-cacebedb925c"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("5cf7f1df-9d1f-4289-add0-1775ad614f25"), new Guid("61578360-3a49-4c34-8604-7b35a3787b95"), new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("75bbda6a-6a53-47d1-ad71-5f5f9446a11e"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("af1e4492-98ee-4451-8ab7-fd8323f29c32"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("ef1fcfbc-60e0-4f17-9308-c583a05d48fd"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("fddaaf20-4ccc-4f4e-a724-dd310272b356"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "FeaturePermissions",
|
||||
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("01e06444-9ca7-4df4-b900-8c3fa051b92f"), "Allows a user to view all expense records across the organization or project, regardless of who submitted or paid them", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "View All" },
|
||||
{ new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"), "Allows a user to create and submit new expense records, including attaching relevant documents like receipts or invoices.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Upload" },
|
||||
{ new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), "Allows a user to examine submitted expenses for accuracy, completeness, and policy compliance before they are approved or rejected.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Review" },
|
||||
{ new Guid("385be49f-8fde-440e-bdbc-3dffeb8dd116"), "Allows a user to view only the expense records that they have personally submitted", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "View Self" },
|
||||
{ new Guid("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3"), "Allows a user to configure and control system settings, such as managing expense types, payment modes, permissions, and overall workflow rules.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Manage" },
|
||||
{ new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"), "Allows a user to handle post-approval actions such as recording payments, updating financial records, or marking expenses as reimbursed or settled.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Process" },
|
||||
{ new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"), "Allows a user to authorize or reject submitted expenses, making them officially accepted or declined within the system.", new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"), true, "Approve" }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "StatusPermissionMapping",
|
||||
columns: new[] { "Id", "PermissionId", "StatusId", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("214354e5-daad-4569-ad69-eb5bf4e87fbc"), new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"), new Guid("61578360-3a49-4c34-8604-7b35a3787b95"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("4652d73f-fc71-4fe1-9f2f-1e48b342d741"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("cd15f9b9-be45-4deb-9c71-2f23f872dbcd"), new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("ed893799-1a5f-4311-a077-de93c86ca8fd"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("f6f26b2f-2fa6-40b7-8601-cbd4bcdda0cc"), new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"), new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BillAttachments_DocumentId",
|
||||
table: "BillAttachments",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BillAttachments_ExpensesId",
|
||||
table: "BillAttachments",
|
||||
column: "ExpensesId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BillAttachments_TenantId",
|
||||
table: "BillAttachments",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpenseLogs_ExpenseId",
|
||||
table: "ExpenseLogs",
|
||||
column: "ExpenseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpenseLogs_TenantId",
|
||||
table: "ExpenseLogs",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpenseLogs_UpdatedById",
|
||||
table: "ExpenseLogs",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_CreatedById",
|
||||
table: "Expenses",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_ExpensesTypeId",
|
||||
table: "Expenses",
|
||||
column: "ExpensesTypeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_PaidById",
|
||||
table: "Expenses",
|
||||
column: "PaidById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_PaymentModeId",
|
||||
table: "Expenses",
|
||||
column: "PaymentModeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_ProjectId",
|
||||
table: "Expenses",
|
||||
column: "ProjectId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_StatusId",
|
||||
table: "Expenses",
|
||||
column: "StatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_TenantId",
|
||||
table: "Expenses",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesReimburse_ReimburseById",
|
||||
table: "ExpensesReimburse",
|
||||
column: "ReimburseById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesReimburse_TenantId",
|
||||
table: "ExpensesReimburse",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesReimburseMapping_ExpensesId",
|
||||
table: "ExpensesReimburseMapping",
|
||||
column: "ExpensesId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesReimburseMapping_ExpensesReimburseId",
|
||||
table: "ExpensesReimburseMapping",
|
||||
column: "ExpensesReimburseId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesReimburseMapping_TenantId",
|
||||
table: "ExpensesReimburseMapping",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesStatusMapping_NextStatusId",
|
||||
table: "ExpensesStatusMapping",
|
||||
column: "NextStatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesStatusMapping_StatusId",
|
||||
table: "ExpensesStatusMapping",
|
||||
column: "StatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesStatusMapping_TenantId",
|
||||
table: "ExpensesStatusMapping",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesStatusMaster_TenantId",
|
||||
table: "ExpensesStatusMaster",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesTypeMaster_TenantId",
|
||||
table: "ExpensesTypeMaster",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PaymentModeMatser_TenantId",
|
||||
table: "PaymentModeMatser",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StatusPermissionMapping_PermissionId",
|
||||
table: "StatusPermissionMapping",
|
||||
column: "PermissionId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StatusPermissionMapping_StatusId",
|
||||
table: "StatusPermissionMapping",
|
||||
column: "StatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StatusPermissionMapping_TenantId",
|
||||
table: "StatusPermissionMapping",
|
||||
column: "TenantId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BillAttachments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ExpenseLogs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ExpensesReimburseMapping");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ExpensesStatusMapping");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "StatusPermissionMapping");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ExpensesReimburse");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Expenses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ExpensesStatusMaster");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ExpensesTypeMaster");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PaymentModeMatser");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("01e06444-9ca7-4df4-b900-8c3fa051b92f"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("385be49f-8fde-440e-bdbc-3dffeb8dd116"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("bdee29a2-b73b-402d-8dd1-c4b1f81ccbc3"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("ea5a1529-4ee8-4828-80ea-0e23c9d4dd11"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("eaafdd76-8aac-45f9-a530-315589c6deca"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("a4e25142-449b-4334-a6e5-22f70e4732d7"));
|
||||
}
|
||||
}
|
||||
}
|
4346
Marco.Pms.DataAccess/Migrations/20250730063711_Change_ExpenseStatus_To_Be_System_Scope.Designer.cs
generated
Normal file
4346
Marco.Pms.DataAccess/Migrations/20250730063711_Change_ExpenseStatus_To_Be_System_Scope.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,437 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Change_ExpenseStatus_To_Be_System_Scope : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ExpensesStatusMapping_Tenants_TenantId",
|
||||
table: "ExpensesStatusMapping");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ExpensesStatusMaster_Tenants_TenantId",
|
||||
table: "ExpensesStatusMaster");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_StatusPermissionMapping_Tenants_TenantId",
|
||||
table: "StatusPermissionMapping");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_StatusPermissionMapping_TenantId",
|
||||
table: "StatusPermissionMapping");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ExpensesStatusMaster_TenantId",
|
||||
table: "ExpensesStatusMaster");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ExpensesStatusMapping_TenantId",
|
||||
table: "ExpensesStatusMapping");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("75bbda6a-6a53-47d1-ad71-5f5f9446a11e"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("fddaaf20-4ccc-4f4e-a724-dd310272b356"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("4652d73f-fc71-4fe1-9f2f-1e48b342d741"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("ed893799-1a5f-4311-a077-de93c86ca8fd"));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TenantId",
|
||||
table: "StatusPermissionMapping");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TenantId",
|
||||
table: "ExpensesStatusMaster");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TenantId",
|
||||
table: "ExpensesStatusMapping");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ApprovedById",
|
||||
table: "Expenses",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProcessedById",
|
||||
table: "Expenses",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ReviewedById",
|
||||
table: "Expenses",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ExpensesStatusMapping",
|
||||
columns: new[] { "Id", "NextStatusId", "StatusId" },
|
||||
values: new object[] { new Guid("4ddddc10-0ffd-4884-accf-d4fa0bd97f54"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729") });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("61578360-3a49-4c34-8604-7b35a3787b95"),
|
||||
columns: new[] { "DisplayName", "Name" },
|
||||
values: new object[] { "Mark as Processed", "Processed" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"),
|
||||
columns: new[] { "Description", "Name" },
|
||||
values: new object[] { "Expense was declined, often with a reason(approval rejected).", "Rejected by Approver" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ExpensesStatusMaster",
|
||||
columns: new[] { "Id", "Color", "Description", "DisplayName", "IsActive", "IsSystem", "Name" },
|
||||
values: new object[] { new Guid("965eda62-7907-4963-b4a1-657fb0b2724b"), "#ff3e1d", "Expense was declined, often with a reason(review rejected).", "Reject", true, true, "Rejected by Reviewer" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "StatusPermissionMapping",
|
||||
columns: new[] { "Id", "PermissionId", "StatusId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("0b7926fc-a34b-4a5b-8c7d-1003480cf0fa"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8") },
|
||||
{ new Guid("722b0c3c-5a78-456d-b9bb-b6ba1b21d59b"), new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"), new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8") },
|
||||
{ new Guid("7deb0945-e1c9-411f-8b3c-c9bdbe3c3c2d"), new Guid("0f57885d-bcb2-4711-ac95-d841ace6d5a7"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ExpensesStatusMapping",
|
||||
columns: new[] { "Id", "NextStatusId", "StatusId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("6b867bec-66e6-42a7-9611-f4595af9b9ce"), new Guid("965eda62-7907-4963-b4a1-657fb0b2724b"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7") },
|
||||
{ new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("965eda62-7907-4963-b4a1-657fb0b2724b") }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "StatusPermissionMapping",
|
||||
columns: new[] { "Id", "PermissionId", "StatusId" },
|
||||
values: new object[] { new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("965eda62-7907-4963-b4a1-657fb0b2724b") });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_ApprovedById",
|
||||
table: "Expenses",
|
||||
column: "ApprovedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_ProcessedById",
|
||||
table: "Expenses",
|
||||
column: "ProcessedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Expenses_ReviewedById",
|
||||
table: "Expenses",
|
||||
column: "ReviewedById");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Expenses_Employees_ApprovedById",
|
||||
table: "Expenses",
|
||||
column: "ApprovedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Expenses_Employees_ProcessedById",
|
||||
table: "Expenses",
|
||||
column: "ProcessedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Expenses_Employees_ReviewedById",
|
||||
table: "Expenses",
|
||||
column: "ReviewedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Expenses_Employees_ApprovedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Expenses_Employees_ProcessedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Expenses_Employees_ReviewedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Expenses_ApprovedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Expenses_ProcessedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Expenses_ReviewedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("4ddddc10-0ffd-4884-accf-d4fa0bd97f54"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6b867bec-66e6-42a7-9611-f4595af9b9ce"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("0b7926fc-a34b-4a5b-8c7d-1003480cf0fa"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("722b0c3c-5a78-456d-b9bb-b6ba1b21d59b"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("7deb0945-e1c9-411f-8b3c-c9bdbe3c3c2d"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("9e2ec648-1ca2-4747-9329-e911b18edb3e"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("965eda62-7907-4963-b4a1-657fb0b2724b"));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ApprovedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProcessedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReviewedById",
|
||||
table: "Expenses");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "TenantId",
|
||||
table: "StatusPermissionMapping",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "TenantId",
|
||||
table: "ExpensesStatusMaster",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "TenantId",
|
||||
table: "ExpensesStatusMapping",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("1fca1700-1266-477d-bba4-9ac3753aa33c"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("36c00548-241c-43ec-bc95-cacebedb925c"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("5cf7f1df-9d1f-4289-add0-1775ad614f25"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("af1e4492-98ee-4451-8ab7-fd8323f29c32"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("ef1fcfbc-60e0-4f17-9308-c583a05d48fd"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "ExpensesStatusMapping",
|
||||
columns: new[] { "Id", "NextStatusId", "StatusId", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("75bbda6a-6a53-47d1-ad71-5f5f9446a11e"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("fddaaf20-4ccc-4f4e-a724-dd310272b356"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("297e0d8f-f668-41b5-bfea-e03b354251c8"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("61578360-3a49-4c34-8604-7b35a3787b95"),
|
||||
columns: new[] { "DisplayName", "Name", "TenantId" },
|
||||
values: new object[] { "Mark as Paid", "Paid", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("6537018f-f4e9-4cb3-a210-6c3b2da999d7"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"),
|
||||
columns: new[] { "Description", "Name", "TenantId" },
|
||||
values: new object[] { "Expense was declined, often with a reason(either review rejected or approval rejected.", "Rejected", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "ExpensesStatusMaster",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("f18c5cfd-7815-4341-8da2-2c2d65778e27"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("214354e5-daad-4569-ad69-eb5bf4e87fbc"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("cd15f9b9-be45-4deb-9c71-2f23f872dbcd"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusPermissionMapping",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("f6f26b2f-2fa6-40b7-8601-cbd4bcdda0cc"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "StatusPermissionMapping",
|
||||
columns: new[] { "Id", "PermissionId", "StatusId", "TenantId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("4652d73f-fc71-4fe1-9f2f-1e48b342d741"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("d1ee5eec-24b6-4364-8673-a8f859c60729"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
|
||||
{ new Guid("ed893799-1a5f-4311-a077-de93c86ca8fd"), new Guid("1f4bda08-1873-449a-bb66-3e8222bd871b"), new Guid("4068007f-c92f-4f37-a907-bc15fe57d4d8"), new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StatusPermissionMapping_TenantId",
|
||||
table: "StatusPermissionMapping",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesStatusMaster_TenantId",
|
||||
table: "ExpensesStatusMaster",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ExpensesStatusMapping_TenantId",
|
||||
table: "ExpensesStatusMapping",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ExpensesStatusMapping_Tenants_TenantId",
|
||||
table: "ExpensesStatusMapping",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ExpensesStatusMaster_Tenants_TenantId",
|
||||
table: "ExpensesStatusMaster",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_StatusPermissionMapping_Tenants_TenantId",
|
||||
table: "StatusPermissionMapping",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
4430
Marco.Pms.DataAccess/Migrations/20250730070549_Added_CurrencyMaster_Table.Designer.cs
generated
Normal file
4430
Marco.Pms.DataAccess/Migrations/20250730070549_Added_CurrencyMaster_Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_CurrencyMaster_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CurrencyMaster",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CurrencyCode = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CurrencyName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Symbol = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CurrencyMaster", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "CurrencyMaster",
|
||||
columns: new[] { "Id", "CurrencyCode", "CurrencyName", "IsActive", "Symbol" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("297e237a-56d3-48f6-b39d-ec3991dea8bf"), "JPY", "Japanese Yen", true, "¥" },
|
||||
{ new Guid("2f672568-a67b-4961-acb2-a8c7834e1762"), "USD", "US Dollar", true, "$" },
|
||||
{ new Guid("3e456237-ef06-4ea1-a261-188c9b0c6df6"), "GBP", "Pound Sterling", true, "£" },
|
||||
{ new Guid("4d1155bb-1448-4d97-a732-96c92eb99c45"), "EUR", "Euro", true, "€" },
|
||||
{ new Guid("78e96e4a-7ce0-4164-ae3a-c833ad45ec2c"), "INR", "Indian Rupee", true, "₹" },
|
||||
{ new Guid("b960166a-f7e9-49e3-bb4b-28511f126c08"), "CNY", "Chinese Yuan (Renminbi)", true, "¥" },
|
||||
{ new Guid("efe9b4f6-64d6-446e-a42d-1c7aaf6dd70d"), "RUB", "Russian Ruble", true, "₽" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CurrencyMaster");
|
||||
}
|
||||
}
|
||||
}
|
3547
Marco.Pms.DataAccess/Migrations/20250731100859_Added_New_Parameters_In_Tenant_Table.Designer.cs
generated
Normal file
3547
Marco.Pms.DataAccess/Migrations/20250731100859_Added_New_Parameters_In_Tenant_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3550
Marco.Pms.DataAccess/Migrations/20250801101253_Added_New_Parameter_In_Tenant_Table.Designer.cs
generated
Normal file
3550
Marco.Pms.DataAccess/Migrations/20250801101253_Added_New_Parameter_In_Tenant_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_New_Parameter_In_Tenant_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OfficeNumber",
|
||||
table: "Tenants",
|
||||
type: "longtext",
|
||||
nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Tenants",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"),
|
||||
column: "OfficeNumber",
|
||||
value: null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OfficeNumber",
|
||||
table: "Tenants");
|
||||
}
|
||||
}
|
||||
}
|
3550
Marco.Pms.DataAccess/Migrations/20250801111158_Fixed_Spelling_Mistake_In_Tenant_Table.Designer.cs
generated
Normal file
3550
Marco.Pms.DataAccess/Migrations/20250801111158_Fixed_Spelling_Mistake_In_Tenant_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Fixed_Spelling_Mistake_In_Tenant_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "OragnizationSize",
|
||||
table: "Tenants",
|
||||
newName: "OrganizationSize");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "OrganizationSize",
|
||||
table: "Tenants",
|
||||
newName: "OragnizationSize");
|
||||
}
|
||||
}
|
||||
}
|
4437
Marco.Pms.DataAccess/Migrations/20250804053705_Added_Updated_At_In_UpdateLogs.Designer.cs
generated
Normal file
4437
Marco.Pms.DataAccess/Migrations/20250804053705_Added_Updated_At_In_UpdateLogs.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Updated_At_In_UpdateLogs : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdateAt",
|
||||
table: "ExpenseLogs",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdateAt",
|
||||
table: "ExpenseLogs");
|
||||
}
|
||||
}
|
||||
}
|
3872
Marco.Pms.DataAccess/Migrations/20250804061007_Added_Subscription_Related_Tables.Designer.cs
generated
Normal file
3872
Marco.Pms.DataAccess/Migrations/20250804061007_Added_Subscription_Related_Tables.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,207 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Subscription_Related_Tables : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SubscriptionStatus",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SubscriptionStatus", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SubscriptionPlans",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PlanName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PriceQuarterly = table.Column<double>(type: "double", nullable: false),
|
||||
PriceMonthly = table.Column<double>(type: "double", nullable: false),
|
||||
PriceHalfMonthly = table.Column<double>(type: "double", nullable: false),
|
||||
PriceYearly = table.Column<double>(type: "double", nullable: false),
|
||||
TrialDays = table.Column<int>(type: "int", nullable: false),
|
||||
MaxUser = table.Column<double>(type: "double", nullable: false),
|
||||
MaxStorage = table.Column<double>(type: "double", nullable: false),
|
||||
FeaturesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreateAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdateAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
CurrencyId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SubscriptionPlans", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SubscriptionPlans_CurrencyMaster_CurrencyId",
|
||||
column: x => x.CurrencyId,
|
||||
principalTable: "CurrencyMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_SubscriptionPlans_Employees_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_SubscriptionPlans_Employees_UpdatedById",
|
||||
column: x => x.UpdatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TenantSubscriptions",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
PlanId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
IsTrial = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
StatusId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CurrencyId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
NextBillingDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
CancellationDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
AutoRemew = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdateAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TenantSubscriptions", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubscriptions_CurrencyMaster_CurrencyId",
|
||||
column: x => x.CurrencyId,
|
||||
principalTable: "CurrencyMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubscriptions_Employees_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubscriptions_Employees_UpdatedById",
|
||||
column: x => x.UpdatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubscriptions_SubscriptionPlans_PlanId",
|
||||
column: x => x.PlanId,
|
||||
principalTable: "SubscriptionPlans",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubscriptions_SubscriptionStatus_StatusId",
|
||||
column: x => x.StatusId,
|
||||
principalTable: "SubscriptionStatus",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TenantSubscriptions_Tenants_TenantId",
|
||||
column: x => x.TenantId,
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "SubscriptionStatus",
|
||||
columns: new[] { "Id", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("1c0e422e-01b6-412f-b72a-1db004cc8a7f"), "Suspended" },
|
||||
{ new Guid("4ed487b1-af22-4e25-aecd-b63fd850cf2d"), "InActive" },
|
||||
{ new Guid("cd3a68ea-41fd-42f0-bd0c-c871c7337727"), "Active" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlans_CreatedById",
|
||||
table: "SubscriptionPlans",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlans_CurrencyId",
|
||||
table: "SubscriptionPlans",
|
||||
column: "CurrencyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlans_UpdatedById",
|
||||
table: "SubscriptionPlans",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubscriptions_CreatedById",
|
||||
table: "TenantSubscriptions",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubscriptions_CurrencyId",
|
||||
table: "TenantSubscriptions",
|
||||
column: "CurrencyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubscriptions_PlanId",
|
||||
table: "TenantSubscriptions",
|
||||
column: "PlanId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubscriptions_StatusId",
|
||||
table: "TenantSubscriptions",
|
||||
column: "StatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubscriptions_TenantId",
|
||||
table: "TenantSubscriptions",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TenantSubscriptions_UpdatedById",
|
||||
table: "TenantSubscriptions",
|
||||
column: "UpdatedById");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "TenantSubscriptions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SubscriptionStatus");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
3872
Marco.Pms.DataAccess/Migrations/20250804063600_Corrected_Typo_In_Subscription_Table.Designer.cs
generated
Normal file
3872
Marco.Pms.DataAccess/Migrations/20250804063600_Corrected_Typo_In_Subscription_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Corrected_Typo_In_Subscription_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "AutoRemew",
|
||||
table: "TenantSubscriptions",
|
||||
newName: "AutoRenew");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "AutoRenew",
|
||||
table: "TenantSubscriptions",
|
||||
newName: "AutoRemew");
|
||||
}
|
||||
}
|
||||
}
|
3872
Marco.Pms.DataAccess/Migrations/20250804064532_Corrected_Typo_In_SubscriptionPlan_Table.Designer.cs
generated
Normal file
3872
Marco.Pms.DataAccess/Migrations/20250804064532_Corrected_Typo_In_SubscriptionPlan_Table.Designer.cs
generated
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Corrected_Typo_In_SubscriptionPlan_Table : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "PriceHalfMonthly",
|
||||
table: "SubscriptionPlans",
|
||||
newName: "PriceHalfYearly");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "PriceHalfYearly",
|
||||
table: "SubscriptionPlans",
|
||||
newName: "PriceHalfMonthly");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,411 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Seprated_SubscriptionPlan_And_SubscriptionPlanDetails : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_StatusMasters_Tenants_TenantId",
|
||||
table: "StatusMasters");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SubscriptionPlans_CurrencyMaster_CurrencyId",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SubscriptionPlans_Employees_CreatedById",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SubscriptionPlans_Employees_UpdatedById",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TenantSubscriptions_SubscriptionPlans_PlanId",
|
||||
table: "TenantSubscriptions");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SubscriptionPlans_CreatedById",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SubscriptionPlans_CurrencyId",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SubscriptionPlans_UpdatedById",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_StatusMasters_TenantId",
|
||||
table: "StatusMasters");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreateAt",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatedById",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CurrencyId",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FeaturesId",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxStorage",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxUser",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PriceHalfYearly",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PriceMonthly",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PriceQuarterly",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PriceYearly",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TrialDays",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdateAt",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedById",
|
||||
table: "SubscriptionPlans");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TenantId",
|
||||
table: "StatusMasters");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsCancelled",
|
||||
table: "TenantSubscriptions",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "MaxUsers",
|
||||
table: "TenantSubscriptions",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SubscriptionPlanDetails",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Price = table.Column<double>(type: "double", nullable: false),
|
||||
Frequency = table.Column<int>(type: "int", nullable: false),
|
||||
TrialDays = table.Column<int>(type: "int", nullable: false),
|
||||
MaxUser = table.Column<double>(type: "double", nullable: false),
|
||||
MaxStorage = table.Column<double>(type: "double", nullable: false),
|
||||
FeaturesId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreateAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdateAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
PlanId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CurrencyId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CreatedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SubscriptionPlanDetails", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SubscriptionPlanDetails_CurrencyMaster_CurrencyId",
|
||||
column: x => x.CurrencyId,
|
||||
principalTable: "CurrencyMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_SubscriptionPlanDetails_Employees_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_SubscriptionPlanDetails_Employees_UpdatedById",
|
||||
column: x => x.UpdatedById,
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_SubscriptionPlanDetails_SubscriptionPlans_PlanId",
|
||||
column: x => x.PlanId,
|
||||
principalTable: "SubscriptionPlans",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlanDetails_CreatedById",
|
||||
table: "SubscriptionPlanDetails",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlanDetails_CurrencyId",
|
||||
table: "SubscriptionPlanDetails",
|
||||
column: "CurrencyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlanDetails_PlanId",
|
||||
table: "SubscriptionPlanDetails",
|
||||
column: "PlanId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlanDetails_UpdatedById",
|
||||
table: "SubscriptionPlanDetails",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TenantSubscriptions_SubscriptionPlanDetails_PlanId",
|
||||
table: "TenantSubscriptions",
|
||||
column: "PlanId",
|
||||
principalTable: "SubscriptionPlanDetails",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TenantSubscriptions_SubscriptionPlanDetails_PlanId",
|
||||
table: "TenantSubscriptions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SubscriptionPlanDetails");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsCancelled",
|
||||
table: "TenantSubscriptions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MaxUsers",
|
||||
table: "TenantSubscriptions");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CreateAt",
|
||||
table: "SubscriptionPlans",
|
||||
type: "datetime(6)",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "CreatedById",
|
||||
table: "SubscriptionPlans",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "CurrencyId",
|
||||
table: "SubscriptionPlans",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "FeaturesId",
|
||||
table: "SubscriptionPlans",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "MaxStorage",
|
||||
table: "SubscriptionPlans",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "MaxUser",
|
||||
table: "SubscriptionPlans",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "PriceHalfYearly",
|
||||
table: "SubscriptionPlans",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "PriceMonthly",
|
||||
table: "SubscriptionPlans",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "PriceQuarterly",
|
||||
table: "SubscriptionPlans",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "PriceYearly",
|
||||
table: "SubscriptionPlans",
|
||||
type: "double",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "TrialDays",
|
||||
table: "SubscriptionPlans",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdateAt",
|
||||
table: "SubscriptionPlans",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UpdatedById",
|
||||
table: "SubscriptionPlans",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "TenantId",
|
||||
table: "StatusMasters",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "StatusMasters",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"),
|
||||
column: "TenantId",
|
||||
value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26"));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlans_CreatedById",
|
||||
table: "SubscriptionPlans",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlans_CurrencyId",
|
||||
table: "SubscriptionPlans",
|
||||
column: "CurrencyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SubscriptionPlans_UpdatedById",
|
||||
table: "SubscriptionPlans",
|
||||
column: "UpdatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_StatusMasters_TenantId",
|
||||
table: "StatusMasters",
|
||||
column: "TenantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_StatusMasters_Tenants_TenantId",
|
||||
table: "StatusMasters",
|
||||
column: "TenantId",
|
||||
principalTable: "Tenants",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SubscriptionPlans_CurrencyMaster_CurrencyId",
|
||||
table: "SubscriptionPlans",
|
||||
column: "CurrencyId",
|
||||
principalTable: "CurrencyMaster",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SubscriptionPlans_Employees_CreatedById",
|
||||
table: "SubscriptionPlans",
|
||||
column: "CreatedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SubscriptionPlans_Employees_UpdatedById",
|
||||
table: "SubscriptionPlans",
|
||||
column: "UpdatedById",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TenantSubscriptions_SubscriptionPlans_PlanId",
|
||||
table: "TenantSubscriptions",
|
||||
column: "PlanId",
|
||||
principalTable: "SubscriptionPlans",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
224
Marco.Pms.Helpers/CacheHelper/EmployeeCache.cs
Normal file
224
Marco.Pms.Helpers/CacheHelper/EmployeeCache.cs
Normal file
@ -0,0 +1,224 @@
|
||||
using Marco.Pms.Model.MongoDBModels.Employees;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Marco.Pms.Helpers.CacheHelper
|
||||
{
|
||||
public class EmployeeCache
|
||||
{
|
||||
private readonly IMongoCollection<EmployeePermissionMongoDB> _collection;
|
||||
private readonly ILogger<EmployeeCache> _logger;
|
||||
|
||||
public EmployeeCache(IConfiguration configuration, ILogger<EmployeeCache> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
var connectionString = configuration["MongoDB:ConnectionString"];
|
||||
var mongoUrl = new MongoUrl(connectionString);
|
||||
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
|
||||
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
|
||||
_collection = mongoDB.GetCollection<EmployeePermissionMongoDB>("EmployeeProfile");
|
||||
}
|
||||
public async Task<bool> AddApplicationRoleToCache(Guid employeeId, List<string> newRoleIds, List<string> newPermissionIds)
|
||||
{
|
||||
|
||||
// 2. Perform database queries concurrently for better performance.
|
||||
var employeeIdString = employeeId.ToString();
|
||||
|
||||
// 5. Build a single, efficient update operation.
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeIdString);
|
||||
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update
|
||||
.AddToSetEach(e => e.ApplicationRoleIds, newRoleIds)
|
||||
.Set(r => r.ExpireAt, DateTime.UtcNow.Date.AddDays(1))
|
||||
.AddToSetEach(e => e.PermissionIds, newPermissionIds);
|
||||
|
||||
var options = new UpdateOptions { IsUpsert = true };
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update, options);
|
||||
|
||||
await InitializeCollectionAsync();
|
||||
|
||||
// 6. Return a more accurate result indicating success for both updates and upserts.
|
||||
// The operation is successful if an existing document was modified OR a new one was created.
|
||||
return result.IsAcknowledged && (result.ModifiedCount > 0 || result.UpsertedId != null);
|
||||
}
|
||||
public async Task<bool> AddProjectsToCache(Guid employeeId, List<Guid> projectIds)
|
||||
{
|
||||
var newprojectIds = projectIds.Select(p => p.ToString()).ToList();
|
||||
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeId.ToString());
|
||||
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update
|
||||
.Set(r => r.ExpireAt, DateTime.UtcNow.Date.AddDays(1))
|
||||
.AddToSetEach(e => e.ProjectIds, newprojectIds);
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update, new UpdateOptions { IsUpsert = true });
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
await InitializeCollectionAsync();
|
||||
return true;
|
||||
}
|
||||
public async Task<List<Guid>> GetProjectsFromCache(Guid employeeId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeId.ToString());
|
||||
|
||||
|
||||
var result = await _collection
|
||||
.Find(filter)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
var projectIds = new List<Guid>();
|
||||
if (result != null)
|
||||
{
|
||||
projectIds = result.ProjectIds.Select(Guid.Parse).ToList();
|
||||
}
|
||||
|
||||
return projectIds;
|
||||
}
|
||||
public async Task<List<Guid>> GetPermissionsFromCache(Guid employeeId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.Eq(e => e.Id, employeeId.ToString());
|
||||
|
||||
|
||||
var result = await _collection
|
||||
.Find(filter)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
var permissionIds = new List<Guid>();
|
||||
if (result != null)
|
||||
{
|
||||
permissionIds = result.PermissionIds.Select(Guid.Parse).ToList();
|
||||
}
|
||||
|
||||
return permissionIds;
|
||||
}
|
||||
public async Task<bool> ClearAllProjectIdsFromCache(Guid employeeId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter
|
||||
.Eq(e => e.Id, employeeId.ToString());
|
||||
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update
|
||||
.Set(e => e.ProjectIds, new List<string>());
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.ModifiedCount == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> ClearAllProjectIdsByRoleIdFromCache(Guid roleId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.AnyEq(e => e.ApplicationRoleIds, roleId.ToString());
|
||||
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update
|
||||
.Set(e => e.ProjectIds, new List<string>());
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> ClearAllProjectIdsByPermissionIdFromCache(Guid permissionId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.AnyEq(e => e.PermissionIds, permissionId.ToString());
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update.Set(e => e.ProjectIds, new List<string>());
|
||||
|
||||
var result = await _collection.UpdateManyAsync(filter, update).ConfigureAwait(false);
|
||||
return result.IsAcknowledged && result.ModifiedCount > 0;
|
||||
}
|
||||
public async Task<bool> RemoveRoleIdFromCache(Guid employeeId, Guid roleId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter
|
||||
.Eq(e => e.Id, employeeId.ToString());
|
||||
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update
|
||||
.Pull(e => e.ApplicationRoleIds, roleId.ToString());
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
return false;
|
||||
|
||||
if (result.ModifiedCount == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> ClearAllPermissionIdsByEmployeeIDFromCache(Guid employeeId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter
|
||||
.Eq(e => e.Id, employeeId.ToString());
|
||||
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update
|
||||
.Set(e => e.PermissionIds, new List<string>());
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> ClearAllPermissionIdsByRoleIdFromCache(Guid roleId)
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.AnyEq(e => e.ApplicationRoleIds, roleId.ToString());
|
||||
|
||||
var update = Builders<EmployeePermissionMongoDB>.Update
|
||||
.Set(e => e.PermissionIds, new List<string>());
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> ClearAllEmployeesFromCache()
|
||||
{
|
||||
var result = await _collection.DeleteManyAsync(FilterDefinition<EmployeePermissionMongoDB>.Empty);
|
||||
|
||||
if (result.DeletedCount == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<bool> ClearAllEmployeesFromCacheByEmployeeIds(List<string> employeeIds)
|
||||
{
|
||||
try
|
||||
{
|
||||
var filter = Builders<EmployeePermissionMongoDB>.Filter.In(x => x.Id, employeeIds);
|
||||
|
||||
var result = await _collection.DeleteManyAsync(filter);
|
||||
|
||||
if (result.DeletedCount == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error occured while deleting employee profile");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// A private method to handle the one-time setup of the collection's indexes.
|
||||
private async Task InitializeCollectionAsync()
|
||||
{
|
||||
var indexKeys = Builders<EmployeePermissionMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
|
||||
var indexOptions = new CreateIndexOptions
|
||||
{
|
||||
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
|
||||
};
|
||||
var indexModel = new CreateIndexModel<EmployeePermissionMongoDB>(indexKeys, indexOptions);
|
||||
await _collection.Indexes.CreateOneAsync(indexModel);
|
||||
}
|
||||
}
|
||||
}
|
178
Marco.Pms.Helpers/CacheHelper/ExpenseCache.cs
Normal file
178
Marco.Pms.Helpers/CacheHelper/ExpenseCache.cs
Normal file
@ -0,0 +1,178 @@
|
||||
using Marco.Pms.Model.MongoDBModels.Expenses;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Marco.Pms.Helpers.CacheHelper
|
||||
{
|
||||
public class ExpenseCache
|
||||
{
|
||||
private readonly IMongoCollection<ExpenseDetailsMongoDB> _collection;
|
||||
public ExpenseCache(IConfiguration configuration)
|
||||
{
|
||||
|
||||
var connectionString = configuration["MongoDB:ConnectionString"];
|
||||
var mongoUrl = new MongoUrl(connectionString);
|
||||
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
|
||||
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
|
||||
_collection = mongoDB.GetCollection<ExpenseDetailsMongoDB>("Expenses");
|
||||
}
|
||||
public async Task AddExpenseToCacheAsync(ExpenseDetailsMongoDB expense)
|
||||
{
|
||||
await _collection.InsertOneAsync(expense);
|
||||
|
||||
await InitializeCollectionAsync();
|
||||
}
|
||||
public async Task AddExpensesListToCacheAsync(List<ExpenseDetailsMongoDB> expenses)
|
||||
{
|
||||
// 1. Add a guard clause to avoid an unnecessary database call for an empty list.
|
||||
if (expenses == null || !expenses.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Perform the insert operation. This is the only responsibility of this method.
|
||||
await _collection.InsertManyAsync(expenses);
|
||||
await InitializeCollectionAsync();
|
||||
}
|
||||
public async Task<(int totalPages, long totalCount, List<ExpenseDetailsMongoDB> expenseList)> GetExpenseListFromCacheAsync(Guid tenantId, Guid loggedInEmployeeId, bool viewAll,
|
||||
bool viewSelf, int pageNumber, int pageSize, ExpensesFilter? expenseFilter, string? searchString)
|
||||
{
|
||||
var filterBuilder = Builders<ExpenseDetailsMongoDB>.Filter;
|
||||
var filter = filterBuilder.Empty;
|
||||
|
||||
// Permission-based filter
|
||||
if (!viewAll && viewSelf)
|
||||
{
|
||||
filter &= filterBuilder.Eq(e => e.CreatedBy.Id, loggedInEmployeeId.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
filter &= filterBuilder.Or(
|
||||
filterBuilder.Eq(e => e.CreatedBy.Id, loggedInEmployeeId.ToString()),
|
||||
filterBuilder.Ne(e => e.Status.Id, "297e0d8f-f668-41b5-bfea-e03b354251c8")
|
||||
);
|
||||
}
|
||||
|
||||
// Apply filters
|
||||
|
||||
if (expenseFilter != null)
|
||||
{
|
||||
if (expenseFilter.StartDate.HasValue && expenseFilter.EndDate.HasValue && expenseFilter.IsTransactionDate == false)
|
||||
{
|
||||
filter &= filterBuilder.Gte(e => e.CreatedAt, expenseFilter.StartDate.Value.Date)
|
||||
& filterBuilder.Lte(e => e.CreatedAt, expenseFilter.EndDate.Value.Date.AddDays(1).AddTicks(-1));
|
||||
}
|
||||
|
||||
if (expenseFilter.StartDate.HasValue && expenseFilter.EndDate.HasValue && expenseFilter.IsTransactionDate)
|
||||
{
|
||||
filter &= filterBuilder.Gte(e => e.TransactionDate, expenseFilter.StartDate.Value.Date)
|
||||
& filterBuilder.Lte(e => e.TransactionDate, expenseFilter.EndDate.Value.Date.AddDays(1).AddTicks(-1));
|
||||
}
|
||||
|
||||
if (expenseFilter.ProjectIds?.Any() == true)
|
||||
{
|
||||
filter &= filterBuilder.In(e => e.Project.Id, expenseFilter.ProjectIds.Select(p => p.ToString()).ToList());
|
||||
}
|
||||
|
||||
if (expenseFilter.StatusIds?.Any() == true)
|
||||
{
|
||||
filter &= filterBuilder.In(e => e.Status.Id, expenseFilter.StatusIds.Select(p => p.ToString()).ToList());
|
||||
}
|
||||
|
||||
if (expenseFilter.PaidById?.Any() == true)
|
||||
{
|
||||
filter &= filterBuilder.In(e => e.PaidBy.Id, expenseFilter.PaidById.Select(p => p.ToString()).ToList());
|
||||
}
|
||||
|
||||
if (expenseFilter.CreatedByIds?.Any() == true && viewAll)
|
||||
{
|
||||
filter &= filterBuilder.In(e => e.CreatedBy.Id, expenseFilter.CreatedByIds.Select(p => p.ToString()).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchString))
|
||||
{
|
||||
var searchPattern = new BsonRegularExpression(searchString, "i");
|
||||
|
||||
// The base text searches remain the same
|
||||
var searchClauses = new List<FilterDefinition<ExpenseDetailsMongoDB>>
|
||||
{
|
||||
filterBuilder.Regex(e => e.Description, searchPattern),
|
||||
filterBuilder.Regex(e => e.TransactionId, searchPattern)
|
||||
};
|
||||
|
||||
// Build the complex filter for PaidBy.FullName
|
||||
var paidByFilter = new BsonDocument("$expr",
|
||||
new BsonDocument("$regexMatch", new BsonDocument
|
||||
{
|
||||
{ "input", new BsonDocument("$concat", new BsonArray { "$PaidBy.FirstName", " ", "$PaidBy.LastName" }) },
|
||||
{ "regex", searchString }, // BsonRegularExpression can't be used here, pass the string
|
||||
{ "options", "i" } // Case-insensitivity option
|
||||
})
|
||||
);
|
||||
searchClauses.Add(paidByFilter);
|
||||
|
||||
// Build the complex filter for CreatedBy.FullName
|
||||
var createdByFilter = new BsonDocument("$expr",
|
||||
new BsonDocument("$regexMatch", new BsonDocument
|
||||
{
|
||||
{ "input", new BsonDocument("$concat", new BsonArray { "$CreatedBy.FirstName", " ", "$CreatedBy.LastName" }) },
|
||||
{ "regex", searchString },
|
||||
{ "options", "i" }
|
||||
})
|
||||
);
|
||||
searchClauses.Add(createdByFilter);
|
||||
|
||||
// Combine all clauses with an OR
|
||||
filter &= filterBuilder.Or(searchClauses);
|
||||
}
|
||||
|
||||
// Total count
|
||||
var totalCount = await _collection.CountDocumentsAsync(filter);
|
||||
var totalPages = (int)Math.Ceiling((double)totalCount / pageSize);
|
||||
|
||||
// Fetch paginated data
|
||||
var expenses = await _collection
|
||||
.Find(filter)
|
||||
.Skip((pageNumber - 1) * pageSize)
|
||||
.Limit(pageSize)
|
||||
.SortByDescending(e => e.CreatedAt)
|
||||
.ToListAsync();
|
||||
|
||||
return (totalPages, totalCount, expenses);
|
||||
}
|
||||
|
||||
public async Task<ExpenseDetailsMongoDB> GetExpenseDetailsByIdAsync(Guid id, Guid tenantId)
|
||||
{
|
||||
var filter = Builders<ExpenseDetailsMongoDB>.Filter.And(
|
||||
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.Id, id.ToString()),
|
||||
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.TenantId, tenantId.ToString())
|
||||
);
|
||||
var expense = await _collection.Find(filter).FirstOrDefaultAsync();
|
||||
|
||||
return expense;
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteExpenseFromCacheAsync(Guid id, Guid tenantId)
|
||||
{
|
||||
var filter = Builders<ExpenseDetailsMongoDB>.Filter.And(
|
||||
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.Id, id.ToString()),
|
||||
Builders<ExpenseDetailsMongoDB>.Filter.Eq(e => e.TenantId, tenantId.ToString())
|
||||
);
|
||||
var result = await _collection.DeleteOneAsync(filter);
|
||||
return result.DeletedCount > 0;
|
||||
}
|
||||
private async Task InitializeCollectionAsync()
|
||||
{
|
||||
var indexKeys = Builders<ExpenseDetailsMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
|
||||
var indexOptions = new CreateIndexOptions
|
||||
{
|
||||
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
|
||||
};
|
||||
var indexModel = new CreateIndexModel<ExpenseDetailsMongoDB>(indexKeys, indexOptions);
|
||||
await _collection.Indexes.CreateOneAsync(indexModel);
|
||||
}
|
||||
}
|
||||
}
|
496
Marco.Pms.Helpers/CacheHelper/ProjectCache.cs
Normal file
496
Marco.Pms.Helpers/CacheHelper/ProjectCache.cs
Normal file
@ -0,0 +1,496 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Master;
|
||||
using Marco.Pms.Model.MongoDBModels.Masters;
|
||||
using Marco.Pms.Model.MongoDBModels.Project;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Marco.Pms.Helpers
|
||||
{
|
||||
public class ProjectCache
|
||||
{
|
||||
private readonly IMongoCollection<ProjectMongoDB> _projectCollection;
|
||||
private readonly IMongoCollection<WorkItemMongoDB> _taskCollection;
|
||||
public ProjectCache(ApplicationDbContext context, IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration["MongoDB:ConnectionString"];
|
||||
var mongoUrl = new MongoUrl(connectionString);
|
||||
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
|
||||
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
|
||||
_projectCollection = mongoDB.GetCollection<ProjectMongoDB>("ProjectDetails");
|
||||
_taskCollection = mongoDB.GetCollection<WorkItemMongoDB>("WorkItemDetails");
|
||||
}
|
||||
|
||||
#region=================================================================== Project Cache Helper ===================================================================
|
||||
|
||||
public async Task AddProjectDetailsToCache(ProjectMongoDB projectDetails)
|
||||
{
|
||||
await _projectCollection.InsertOneAsync(projectDetails);
|
||||
|
||||
await InitializeCollectionAsync();
|
||||
|
||||
}
|
||||
public async Task AddProjectDetailsListToCache(List<ProjectMongoDB> projectDetailsList)
|
||||
{
|
||||
// 1. Add a guard clause to avoid an unnecessary database call for an empty list.
|
||||
if (projectDetailsList == null || !projectDetailsList.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Perform the insert operation. This is the only responsibility of this method.
|
||||
await _projectCollection.InsertManyAsync(projectDetailsList);
|
||||
await InitializeCollectionAsync();
|
||||
}
|
||||
private async Task InitializeCollectionAsync()
|
||||
{
|
||||
var indexKeys = Builders<ProjectMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
|
||||
var indexOptions = new CreateIndexOptions
|
||||
{
|
||||
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
|
||||
};
|
||||
var indexModel = new CreateIndexModel<ProjectMongoDB>(indexKeys, indexOptions);
|
||||
await _projectCollection.Indexes.CreateOneAsync(indexModel);
|
||||
}
|
||||
public async Task<bool> UpdateProjectDetailsOnlyToCache(Project project, StatusMaster projectStatus)
|
||||
{
|
||||
// Build the update definition
|
||||
var updates = Builders<ProjectMongoDB>.Update.Combine(
|
||||
Builders<ProjectMongoDB>.Update.Set(r => r.Name, project.Name),
|
||||
Builders<ProjectMongoDB>.Update.Set(r => r.ProjectAddress, project.ProjectAddress),
|
||||
Builders<ProjectMongoDB>.Update.Set(r => r.ShortName, project.ShortName),
|
||||
Builders<ProjectMongoDB>.Update.Set(r => r.ProjectStatus, new StatusMasterMongoDB
|
||||
{
|
||||
Id = projectStatus.Id.ToString(),
|
||||
Status = projectStatus.Status
|
||||
}),
|
||||
Builders<ProjectMongoDB>.Update.Set(r => r.StartDate, project.StartDate),
|
||||
Builders<ProjectMongoDB>.Update.Set(r => r.EndDate, project.EndDate),
|
||||
Builders<ProjectMongoDB>.Update.Set(r => r.ContactPerson, project.ContactPerson)
|
||||
);
|
||||
|
||||
// Perform the update
|
||||
var result = await _projectCollection.UpdateOneAsync(
|
||||
filter: r => r.Id == project.Id.ToString(),
|
||||
update: updates
|
||||
);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
public async Task<ProjectMongoDB?> GetProjectDetailsFromCache(Guid projectId)
|
||||
{
|
||||
|
||||
// Build filter and projection to exclude large 'Buildings' list
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, projectId.ToString());
|
||||
var projection = Builders<ProjectMongoDB>.Projection.Exclude(p => p.Buildings);
|
||||
|
||||
// Perform query
|
||||
var project = await _projectCollection
|
||||
.Find(filter)
|
||||
.Project<ProjectMongoDB>(projection)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return project;
|
||||
}
|
||||
public async Task<ProjectMongoDB?> GetProjectDetailsWithBuildingsFromCache(Guid projectId)
|
||||
{
|
||||
|
||||
// Build filter and projection to exclude large 'Buildings' list
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, projectId.ToString());
|
||||
|
||||
// Perform query
|
||||
var project = await _projectCollection
|
||||
.Find(filter)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return project;
|
||||
}
|
||||
public async Task<List<ProjectMongoDB>> GetProjectDetailsListFromCache(List<Guid> projectIds)
|
||||
{
|
||||
List<string> stringProjectIds = projectIds.Select(p => p.ToString()).ToList();
|
||||
var filter = Builders<ProjectMongoDB>.Filter.In(p => p.Id, stringProjectIds);
|
||||
var projection = Builders<ProjectMongoDB>.Projection.Exclude(p => p.Buildings);
|
||||
var projects = await _projectCollection
|
||||
.Find(filter)
|
||||
.Project<ProjectMongoDB>(projection)
|
||||
.ToListAsync();
|
||||
return projects;
|
||||
}
|
||||
public async Task<bool> DeleteProjectByIdFromCacheAsync(Guid projectId)
|
||||
{
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(e => e.Id, projectId.ToString());
|
||||
var result = await _projectCollection.DeleteOneAsync(filter);
|
||||
return result.DeletedCount > 0;
|
||||
}
|
||||
public async Task<bool> RemoveProjectsFromCacheAsync(List<Guid> projectIds)
|
||||
{
|
||||
var stringIds = projectIds.Select(id => id.ToString()).ToList();
|
||||
var filter = Builders<ProjectMongoDB>.Filter.In(p => p.Id, stringIds);
|
||||
var result = await _projectCollection.DeleteManyAsync(filter);
|
||||
return result.DeletedCount > 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region=================================================================== Project infrastructure Cache Helper ===================================================================
|
||||
|
||||
public async Task AddBuildngInfraToCache(Guid projectId, Building? building, Floor? floor, WorkArea? workArea, Guid? buildingId)
|
||||
{
|
||||
var stringProjectId = projectId.ToString();
|
||||
|
||||
// Add Building
|
||||
if (building != null)
|
||||
{
|
||||
var buildingMongo = new BuildingMongoDB
|
||||
{
|
||||
Id = building.Id.ToString(),
|
||||
BuildingName = building.Name,
|
||||
Description = building.Description,
|
||||
PlannedWork = 0,
|
||||
CompletedWork = 0,
|
||||
Floors = new List<FloorMongoDB>()
|
||||
};
|
||||
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
|
||||
var update = Builders<ProjectMongoDB>.Update.Push("Buildings", buildingMongo);
|
||||
|
||||
var result = await _projectCollection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Add Floor
|
||||
if (floor != null)
|
||||
{
|
||||
var floorMongo = new FloorMongoDB
|
||||
{
|
||||
Id = floor.Id.ToString(),
|
||||
FloorName = floor.FloorName,
|
||||
PlannedWork = 0,
|
||||
CompletedWork = 0,
|
||||
WorkAreas = new List<WorkAreaMongoDB>()
|
||||
};
|
||||
|
||||
var filter = Builders<ProjectMongoDB>.Filter.And(
|
||||
Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId),
|
||||
Builders<ProjectMongoDB>.Filter.Eq("Buildings._id", floor.BuildingId.ToString())
|
||||
);
|
||||
|
||||
var update = Builders<ProjectMongoDB>.Update.Push("Buildings.$.Floors", floorMongo);
|
||||
var result = await _projectCollection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Add WorkArea
|
||||
if (workArea != null && buildingId != null)
|
||||
{
|
||||
var workAreaMongo = new WorkAreaMongoDB
|
||||
{
|
||||
Id = workArea.Id.ToString(),
|
||||
AreaName = workArea.AreaName,
|
||||
PlannedWork = 0,
|
||||
CompletedWork = 0
|
||||
};
|
||||
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
|
||||
|
||||
var arrayFilters = new List<ArrayFilterDefinition>
|
||||
{
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + buildingId + "' }"),
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + workArea.FloorId + "' }")
|
||||
};
|
||||
|
||||
var update = Builders<ProjectMongoDB>.Update.Push("Buildings.$[b].Floors.$[f].WorkAreas", workAreaMongo);
|
||||
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
|
||||
|
||||
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
public async Task<bool> UpdateBuildngInfraToCache(Guid projectId, Building? building, Floor? floor, WorkArea? workArea, Guid? buildingId)
|
||||
{
|
||||
var stringProjectId = projectId.ToString();
|
||||
|
||||
// Update Building
|
||||
if (building != null)
|
||||
{
|
||||
var filter = Builders<ProjectMongoDB>.Filter.And(
|
||||
Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId),
|
||||
Builders<ProjectMongoDB>.Filter.Eq("Buildings._id", building.Id.ToString())
|
||||
);
|
||||
|
||||
var update = Builders<ProjectMongoDB>.Update.Combine(
|
||||
Builders<ProjectMongoDB>.Update.Set("Buildings.$.BuildingName", building.Name),
|
||||
Builders<ProjectMongoDB>.Update.Set("Buildings.$.Description", building.Description)
|
||||
);
|
||||
|
||||
var result = await _projectCollection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Update Floor
|
||||
if (floor != null)
|
||||
{
|
||||
var arrayFilters = new List<ArrayFilterDefinition>
|
||||
{
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + floor.BuildingId + "' }"),
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + floor.Id + "' }")
|
||||
};
|
||||
|
||||
var update = Builders<ProjectMongoDB>.Update.Set("Buildings.$[b].Floors.$[f].FloorName", floor.FloorName);
|
||||
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
|
||||
|
||||
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Update WorkArea
|
||||
if (workArea != null && buildingId != null)
|
||||
{
|
||||
var arrayFilters = new List<ArrayFilterDefinition>
|
||||
{
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + buildingId + "' }"),
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + workArea.FloorId + "' }"),
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'a._id': '" + workArea.Id + "' }")
|
||||
};
|
||||
|
||||
var update = Builders<ProjectMongoDB>.Update.Set("Buildings.$[b].Floors.$[f].WorkAreas.$[a].AreaName", workArea.AreaName);
|
||||
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, stringProjectId);
|
||||
|
||||
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
|
||||
|
||||
if (result.MatchedCount == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public async Task<List<BuildingMongoDB>?> GetBuildingInfraFromCache(Guid projectId)
|
||||
{
|
||||
|
||||
// Filter by project ID
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq(p => p.Id, projectId.ToString());
|
||||
|
||||
// Project only the "Buildings" field from the document
|
||||
var buildings = await _projectCollection
|
||||
.Find(filter)
|
||||
.Project(p => p.Buildings)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return buildings;
|
||||
}
|
||||
public async Task UpdatePlannedAndCompleteWorksInBuildingFromCache(Guid workAreaId, double plannedWork, double completedWork)
|
||||
{
|
||||
var filter = Builders<ProjectMongoDB>.Filter.Eq("Buildings.Floors.WorkAreas._id", workAreaId.ToString());
|
||||
var project = await _projectCollection.Find(filter).FirstOrDefaultAsync();
|
||||
|
||||
string? selectedBuildingId = null;
|
||||
string? selectedFloorId = null;
|
||||
string? selectedWorkAreaId = null;
|
||||
|
||||
foreach (var building in project.Buildings)
|
||||
{
|
||||
foreach (var floor in building.Floors)
|
||||
{
|
||||
foreach (var area in floor.WorkAreas)
|
||||
{
|
||||
if (area.Id == workAreaId.ToString())
|
||||
{
|
||||
selectedWorkAreaId = area.Id;
|
||||
selectedFloorId = floor.Id;
|
||||
selectedBuildingId = building.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var arrayFilters = new List<ArrayFilterDefinition>
|
||||
{
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'b._id': '" + selectedBuildingId + "' }"),
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'f._id': '" + selectedFloorId + "' }"),
|
||||
new JsonArrayFilterDefinition<BsonDocument>("{ 'a._id': '" + selectedWorkAreaId + "' }")
|
||||
};
|
||||
var updateOptions = new UpdateOptions { ArrayFilters = arrayFilters };
|
||||
var update = Builders<ProjectMongoDB>.Update
|
||||
.Inc("Buildings.$[b].Floors.$[f].WorkAreas.$[a].PlannedWork", plannedWork)
|
||||
.Inc("Buildings.$[b].Floors.$[f].WorkAreas.$[a].CompletedWork", completedWork)
|
||||
.Inc("Buildings.$[b].Floors.$[f].PlannedWork", plannedWork)
|
||||
.Inc("Buildings.$[b].Floors.$[f].CompletedWork", completedWork)
|
||||
.Inc("Buildings.$[b].PlannedWork", plannedWork)
|
||||
.Inc("Buildings.$[b].CompletedWork", completedWork)
|
||||
.Inc("PlannedWork", plannedWork)
|
||||
.Inc("CompletedWork", completedWork);
|
||||
var result = await _projectCollection.UpdateOneAsync(filter, update, updateOptions);
|
||||
|
||||
}
|
||||
public async Task<WorkAreaInfoMongoDB?> GetBuildingAndFloorByWorkAreaIdFromCache(Guid workAreaId)
|
||||
{
|
||||
var pipeline = new[]
|
||||
{
|
||||
new BsonDocument("$unwind", "$Buildings"),
|
||||
new BsonDocument("$unwind", "$Buildings.Floors"),
|
||||
new BsonDocument("$unwind", "$Buildings.Floors.WorkAreas"),
|
||||
new BsonDocument("$match", new BsonDocument("Buildings.Floors.WorkAreas._id", workAreaId.ToString())),
|
||||
new BsonDocument("$project", new BsonDocument
|
||||
{
|
||||
{ "_id", 0 },
|
||||
{ "ProjectId", "$_id" },
|
||||
{ "ProjectName", "$Name" },
|
||||
{ "PlannedWork", "$PlannedWork" },
|
||||
{ "CompletedWork", "$CompletedWork" },
|
||||
{
|
||||
"Building", new BsonDocument
|
||||
{
|
||||
{ "_id", "$Buildings._id" },
|
||||
{ "BuildingName", "$Buildings.BuildingName" },
|
||||
{ "Description", "$Buildings.Description" },
|
||||
{ "PlannedWork", "$Buildings.PlannedWork" },
|
||||
{ "CompletedWork", "$Buildings.CompletedWork" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Floor", new BsonDocument
|
||||
{
|
||||
{ "_id", "$Buildings.Floors._id" },
|
||||
{ "FloorName", "$Buildings.Floors.FloorName" },
|
||||
{ "PlannedWork", "$Buildings.Floors.PlannedWork" },
|
||||
{ "CompletedWork", "$Buildings.Floors.CompletedWork" }
|
||||
}
|
||||
},
|
||||
{ "WorkArea", "$Buildings.Floors.WorkAreas" }
|
||||
})
|
||||
};
|
||||
var result = await _projectCollection.Aggregate<WorkAreaInfoMongoDB>(pipeline).FirstOrDefaultAsync();
|
||||
if (result == null)
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region=================================================================== WorkItem Cache Helper ===================================================================
|
||||
|
||||
public async Task<List<WorkItemMongoDB>> GetWorkItemsByWorkAreaIdsFromCache(List<Guid> workAreaIds)
|
||||
{
|
||||
var stringWorkAreaIds = workAreaIds.Select(wa => wa.ToString()).ToList();
|
||||
var filter = Builders<WorkItemMongoDB>.Filter.In(w => w.WorkAreaId, stringWorkAreaIds);
|
||||
|
||||
var workItems = await _taskCollection // replace with your actual collection name
|
||||
.Find(filter)
|
||||
.ToListAsync();
|
||||
|
||||
return workItems;
|
||||
}
|
||||
public async Task ManageWorkItemDetailsToCache(List<WorkItemMongoDB> workItems)
|
||||
{
|
||||
foreach (WorkItemMongoDB workItem in workItems)
|
||||
{
|
||||
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.Id, workItem.Id.ToString());
|
||||
var updates = Builders<WorkItemMongoDB>.Update.Combine(
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.WorkAreaId, workItem.WorkAreaId.ToString()),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.ParentTaskId, (workItem.ParentTaskId != null ? workItem.ParentTaskId.ToString() : null)),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.PlannedWork, workItem.PlannedWork),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.TodaysAssigned, workItem.TodaysAssigned),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.CompletedWork, workItem.CompletedWork),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.Description, workItem.Description),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.TaskDate, workItem.TaskDate),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.ExpireAt, DateTime.UtcNow.Date.AddDays(1)),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.ActivityMaster, workItem.ActivityMaster),
|
||||
Builders<WorkItemMongoDB>.Update.Set(r => r.WorkCategoryMaster, workItem.WorkCategoryMaster)
|
||||
);
|
||||
var options = new UpdateOptions { IsUpsert = true };
|
||||
var result = await _taskCollection.UpdateOneAsync(filter, updates, options);
|
||||
if (result.UpsertedId != null)
|
||||
{
|
||||
var indexKeys = Builders<WorkItemMongoDB>.IndexKeys.Ascending(x => x.ExpireAt);
|
||||
var indexOptions = new CreateIndexOptions
|
||||
{
|
||||
ExpireAfter = TimeSpan.Zero // required for fixed expiration time
|
||||
};
|
||||
var indexModel = new CreateIndexModel<WorkItemMongoDB>(indexKeys, indexOptions);
|
||||
await _taskCollection.Indexes.CreateOneAsync(indexModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
public async Task<List<WorkItemMongoDB>> GetWorkItemDetailsByWorkAreaFromCache(Guid workAreaId)
|
||||
{
|
||||
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.WorkAreaId, workAreaId.ToString());
|
||||
|
||||
var options = new UpdateOptions { IsUpsert = true };
|
||||
var workItems = await _taskCollection
|
||||
.Find(filter)
|
||||
.ToListAsync();
|
||||
return workItems;
|
||||
}
|
||||
public async Task<WorkItemMongoDB> GetWorkItemDetailsByIdFromCache(Guid id)
|
||||
{
|
||||
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.Id, id.ToString());
|
||||
|
||||
var options = new UpdateOptions { IsUpsert = true };
|
||||
var workItem = await _taskCollection
|
||||
.Find(filter)
|
||||
.FirstOrDefaultAsync();
|
||||
return workItem;
|
||||
}
|
||||
public async Task<bool> UpdatePlannedAndCompleteWorksInWorkItemToCache(Guid id, double plannedWork, double completedWork, double todaysAssigned)
|
||||
{
|
||||
var filter = Builders<WorkItemMongoDB>.Filter.Eq(p => p.Id, id.ToString());
|
||||
var updates = Builders<WorkItemMongoDB>.Update
|
||||
.Inc("PlannedWork", plannedWork)
|
||||
.Inc("CompletedWork", completedWork)
|
||||
.Inc("TodaysAssigned", todaysAssigned);
|
||||
|
||||
var result = await _taskCollection.UpdateOneAsync(filter, updates);
|
||||
if (result.ModifiedCount > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public async Task<bool> DeleteWorkItemByIdFromCacheAsync(Guid workItemId)
|
||||
{
|
||||
var filter = Builders<WorkItemMongoDB>.Filter.Eq(e => e.Id, workItemId.ToString());
|
||||
var result = await _taskCollection.DeleteOneAsync(filter);
|
||||
return result.DeletedCount > 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
42
Marco.Pms.Helpers/CacheHelper/ReportCache.cs
Normal file
42
Marco.Pms.Helpers/CacheHelper/ReportCache.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using Marco.Pms.Model.MongoDBModels.Utility;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Marco.Pms.Helpers.CacheHelper
|
||||
{
|
||||
public class ReportCache
|
||||
{
|
||||
private readonly IMongoCollection<ProjectReportEmailMongoDB> _projectReportCollection;
|
||||
public ReportCache(IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration["MongoDB:ConnectionString"];
|
||||
var mongoUrl = new MongoUrl(connectionString);
|
||||
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
|
||||
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
|
||||
_projectReportCollection = mongoDB.GetCollection<ProjectReportEmailMongoDB>("ProjectReportMail");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves project report emails from the cache based on their sent status.
|
||||
/// </summary>
|
||||
/// <param name="isSent">True to get sent reports, false to get unsent reports.</param>
|
||||
/// <returns>A list of ProjectReportEmailMongoDB objects.</returns>
|
||||
public async Task<List<ProjectReportEmailMongoDB>> GetProjectReportMailFromCache(bool isSent)
|
||||
{
|
||||
var filter = Builders<ProjectReportEmailMongoDB>.Filter.Eq(p => p.IsSent, isSent);
|
||||
var reports = await _projectReportCollection.Find(filter).ToListAsync();
|
||||
return reports;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a project report email to the cache.
|
||||
/// </summary>
|
||||
/// <param name="report">The ProjectReportEmailMongoDB object to add.</param>
|
||||
/// <returns>A Task representing the asynchronous operation.</returns>
|
||||
public async Task AddProjectReportMailToCache(ProjectReportEmailMongoDB report)
|
||||
{
|
||||
// Consider adding validation or logging here.
|
||||
await _projectReportCollection.InsertOneAsync(report);
|
||||
}
|
||||
}
|
||||
}
|
18
Marco.Pms.Helpers/Marco.Pms.Helpers.csproj
Normal file
18
Marco.Pms.Helpers/Marco.Pms.Helpers.csproj
Normal file
@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Marco.Pms.DataAccess\Marco.Pms.DataAccess.csproj" />
|
||||
<ProjectReference Include="..\Marco.Pms.Model\Marco.Pms.Model.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
53
Marco.Pms.Helpers/Utility/FeatureDetailsHelper.cs
Normal file
53
Marco.Pms.Helpers/Utility/FeatureDetailsHelper.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using Marco.Pms.Model.TenantModels.MongoDBModel;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Marco.Pms.Helpers.Utility
|
||||
{
|
||||
public class FeatureDetailsHelper
|
||||
{
|
||||
private readonly IMongoCollection<FeatureDetails> _collection;
|
||||
private readonly ILogger<FeatureDetailsHelper> _logger;
|
||||
public FeatureDetailsHelper(IConfiguration configuration, ILogger<FeatureDetailsHelper> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
var connectionString = configuration["MongoDB:ModificationConnectionString"];
|
||||
var mongoUrl = new MongoUrl(connectionString);
|
||||
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
|
||||
var mongoDB = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
|
||||
_collection = mongoDB.GetCollection<FeatureDetails>("FeatureDetails");
|
||||
}
|
||||
public async Task<FeatureDetails?> GetFeatureDetails(Guid Id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var filter = Builders<FeatureDetails>.Filter.Eq(e => e.Id, Id);
|
||||
|
||||
var result = await _collection
|
||||
.Find(filter)
|
||||
.FirstOrDefaultAsync();
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception occured while fetchig features for subscription plan");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public async Task<bool> AddFeatureDetails(FeatureDetails featureDetails)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _collection.InsertOneAsync(featureDetails);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Exception occured while fetchig features for subscription plan");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
224
Marco.Pms.Helpers/Utility/SidebarMenuHelper.cs
Normal file
224
Marco.Pms.Helpers/Utility/SidebarMenuHelper.cs
Normal file
@ -0,0 +1,224 @@
|
||||
using Marco.Pms.Model.AppMenu;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Marco.Pms.CacheHelper
|
||||
{
|
||||
public class SidebarMenuHelper
|
||||
{
|
||||
private readonly IMongoCollection<MenuSection> _collection;
|
||||
private readonly ILogger<SidebarMenuHelper> _logger;
|
||||
|
||||
public SidebarMenuHelper(IConfiguration configuration, ILogger<SidebarMenuHelper> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
var connectionString = configuration["MongoDB:ModificationConnectionString"];
|
||||
var mongoUrl = new MongoUrl(connectionString);
|
||||
var client = new MongoClient(mongoUrl);
|
||||
var database = client.GetDatabase(mongoUrl.DatabaseName);
|
||||
_collection = database.GetCollection<MenuSection>("Menus");
|
||||
}
|
||||
|
||||
public async Task<MenuSection?> CreateMenuSectionAsync(MenuSection section)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _collection.InsertOneAsync(section);
|
||||
return section;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error occurred while adding MenuSection.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<MenuSection?> UpdateMenuSectionAsync(Guid sectionId, MenuSection updatedSection)
|
||||
{
|
||||
try
|
||||
{
|
||||
var filter = Builders<MenuSection>.Filter.Eq(s => s.Id, sectionId);
|
||||
|
||||
var update = Builders<MenuSection>.Update
|
||||
.Set(s => s.Header, updatedSection.Header)
|
||||
.Set(s => s.Title, updatedSection.Title)
|
||||
.Set(s => s.Items, updatedSection.Items);
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.ModifiedCount > 0)
|
||||
{
|
||||
return await _collection.Find(s => s.Id == sectionId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error updating MenuSection.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<MenuSection?> AddMenuItemAsync(Guid sectionId, MenuItem newItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
newItem.Id = Guid.NewGuid();
|
||||
|
||||
var filter = Builders<MenuSection>.Filter.Eq(s => s.Id, sectionId);
|
||||
|
||||
var update = Builders<MenuSection>.Update.Push(s => s.Items, newItem);
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.ModifiedCount > 0)
|
||||
{
|
||||
return await _collection.Find(s => s.Id == sectionId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error adding menu item.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<MenuItem?> UpdateMenuItemAsync(Guid sectionId, Guid itemId, MenuItem updatedItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
var filter = Builders<MenuSection>.Filter.And(
|
||||
Builders<MenuSection>.Filter.Eq(s => s.Id, sectionId),
|
||||
Builders<MenuSection>.Filter.ElemMatch(s => s.Items, i => i.Id == itemId)
|
||||
);
|
||||
|
||||
var update = Builders<MenuSection>.Update
|
||||
.Set("Items.$.Text", updatedItem.Text)
|
||||
.Set("Items.$.Icon", updatedItem.Icon)
|
||||
.Set("Items.$.Available", updatedItem.Available)
|
||||
.Set("Items.$.Link", updatedItem.Link)
|
||||
.Set("Items.$.PermissionIds", updatedItem.PermissionIds);
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.ModifiedCount > 0)
|
||||
{
|
||||
// Re-fetch section and return the updated item
|
||||
var section = await _collection.Find(s => s.Id == sectionId).FirstOrDefaultAsync();
|
||||
return section?.Items.FirstOrDefault(i => i.Id == itemId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error updating MenuItem.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<MenuSection?> AddSubMenuItemAsync(Guid sectionId, Guid itemId, SubMenuItem newSubItem)
|
||||
{
|
||||
try
|
||||
{
|
||||
newSubItem.Id = Guid.NewGuid();
|
||||
|
||||
// Match the MenuSection and the specific MenuItem inside it
|
||||
var filter = Builders<MenuSection>.Filter.And(
|
||||
Builders<MenuSection>.Filter.Eq(s => s.Id, sectionId),
|
||||
Builders<MenuSection>.Filter.ElemMatch(s => s.Items, i => i.Id == itemId)
|
||||
);
|
||||
|
||||
// Use positional operator `$` to target matched MenuItem and push into its Submenu
|
||||
var update = Builders<MenuSection>.Update.Push("Items.$.Submenu", newSubItem);
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update);
|
||||
|
||||
if (result.ModifiedCount > 0)
|
||||
{
|
||||
return await _collection.Find(s => s.Id == sectionId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error adding submenu item.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<SubMenuItem?> UpdateSubmenuItemAsync(Guid sectionId, Guid itemId, Guid subItemId, SubMenuItem updatedSub)
|
||||
{
|
||||
try
|
||||
{
|
||||
var filter = Builders<MenuSection>.Filter.Eq(s => s.Id, sectionId);
|
||||
|
||||
var arrayFilters = new List<ArrayFilterDefinition>
|
||||
{
|
||||
new BsonDocumentArrayFilterDefinition<BsonDocument>(
|
||||
new BsonDocument("item._id", itemId.ToString())),
|
||||
new BsonDocumentArrayFilterDefinition<BsonDocument>(
|
||||
new BsonDocument("sub._id", subItemId.ToString()))
|
||||
};
|
||||
|
||||
var update = Builders<MenuSection>.Update
|
||||
.Set("Items.$[item].Submenu.$[sub].Text", updatedSub.Text)
|
||||
.Set("Items.$[item].Submenu.$[sub].Available", updatedSub.Available)
|
||||
.Set("Items.$[item].Submenu.$[sub].Link", updatedSub.Link)
|
||||
.Set("Items.$[item].Submenu.$[sub].PermissionKeys", updatedSub.PermissionIds);
|
||||
|
||||
var options = new UpdateOptions { ArrayFilters = arrayFilters };
|
||||
|
||||
var result = await _collection.UpdateOneAsync(filter, update, options);
|
||||
|
||||
if (result.ModifiedCount == 0)
|
||||
return null;
|
||||
|
||||
var updatedSection = await _collection.Find(x => x.Id == sectionId).FirstOrDefaultAsync();
|
||||
|
||||
var subItem = updatedSection?.Items
|
||||
.FirstOrDefault(i => i.Id == itemId)?
|
||||
.Submenu
|
||||
.FirstOrDefault(s => s.Id == subItemId);
|
||||
|
||||
return subItem;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error updating SubMenuItem.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<List<MenuSection>> GetAllMenuSectionsAsync(Guid tenantId)
|
||||
{
|
||||
var filter = Builders<MenuSection>.Filter.Eq(e => e.TenantId, tenantId);
|
||||
|
||||
var result = await _collection
|
||||
.Find(filter)
|
||||
.ToListAsync();
|
||||
if (result.Any())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
tenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26");
|
||||
filter = Builders<MenuSection>.Filter.Eq(e => e.TenantId, tenantId);
|
||||
|
||||
result = await _collection
|
||||
.Find(filter)
|
||||
.ToListAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
128
Marco.Pms.Helpers/Utility/UtilityMongoDBHelper.cs
Normal file
128
Marco.Pms.Helpers/Utility/UtilityMongoDBHelper.cs
Normal file
@ -0,0 +1,128 @@
|
||||
using Marco.Pms.Model.MongoDBModels.Utility;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
using System.Collections;
|
||||
|
||||
namespace Marco.Pms.Helpers.Utility
|
||||
{
|
||||
public class UtilityMongoDBHelper
|
||||
{
|
||||
private readonly IMongoDatabase _mongoDatabase;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<UtilityMongoDBHelper> _logger;
|
||||
public UtilityMongoDBHelper(IConfiguration configuration, ILogger<UtilityMongoDBHelper> logger)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_logger = logger;
|
||||
var connectionString = configuration["MongoDB:ModificationConnectionString"];
|
||||
var mongoUrl = new MongoUrl(connectionString);
|
||||
var client = new MongoClient(mongoUrl); // Your MongoDB connection string
|
||||
_mongoDatabase = client.GetDatabase(mongoUrl.DatabaseName); // Your MongoDB Database name
|
||||
}
|
||||
|
||||
#region =================================================================== Update Log Helper Functions ===================================================================
|
||||
public async Task PushToUpdateLogsAsync(UpdateLogsObject oldObject, string collectionName)
|
||||
{
|
||||
var collection = _mongoDatabase.GetCollection<UpdateLogsObject>(collectionName);
|
||||
await collection.InsertOneAsync(oldObject);
|
||||
}
|
||||
|
||||
public async Task<List<UpdateLogsObject>> GetFromUpdateLogsByEntityIdAsync(Guid entityId, string collectionName)
|
||||
{
|
||||
var collection = _mongoDatabase.GetCollection<UpdateLogsObject>(collectionName);
|
||||
var filter = Builders<UpdateLogsObject>.Filter.Eq(p => p.EntityId, entityId.ToString());
|
||||
|
||||
List<UpdateLogsObject> result = await collection
|
||||
.Find(filter)
|
||||
.ToListAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<UpdateLogsObject>> GetFromUpdateLogsByUpdetedByIdAsync(Guid updatedById, string collectionName)
|
||||
{
|
||||
var collection = _mongoDatabase.GetCollection<UpdateLogsObject>(collectionName);
|
||||
var filter = Builders<UpdateLogsObject>.Filter.Eq(p => p.UpdatedById, updatedById.ToString());
|
||||
|
||||
List<UpdateLogsObject> result = await collection
|
||||
.Find(filter)
|
||||
.ToListAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public BsonDocument EntityToBsonDocument(object entity)
|
||||
{
|
||||
var bson = new BsonDocument();
|
||||
|
||||
var props = entity.GetType().GetProperties();
|
||||
foreach (var prop in props)
|
||||
{
|
||||
var value = prop.GetValue(entity);
|
||||
if (value == null)
|
||||
{
|
||||
bson[prop.Name] = BsonNull.Value;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value is Guid guidValue)
|
||||
{
|
||||
bson[prop.Name] = guidValue.ToString(); // store Guid as string
|
||||
}
|
||||
else if (value is string || value.GetType().IsPrimitive || value is DateTime)
|
||||
{
|
||||
bson[prop.Name] = BsonValue.Create(value); // simple types
|
||||
}
|
||||
else if (value is IEnumerable list && !(value is string))
|
||||
{
|
||||
var array = new BsonArray();
|
||||
foreach (var item in list)
|
||||
{
|
||||
array.Add(EntityToBsonDocument(item)); // recursive
|
||||
}
|
||||
bson[prop.Name] = array;
|
||||
}
|
||||
else
|
||||
{
|
||||
// nested object
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return bson;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region =================================================================== S3 deletion Helper Functions ===================================================================
|
||||
|
||||
public async Task PushToS3DeletionAsync(List<S3DeletionObject> deletionObject)
|
||||
{
|
||||
var bucketName = _configuration["AWS:BucketName"];
|
||||
if (bucketName != null)
|
||||
{
|
||||
deletionObject = deletionObject.Select(d => new S3DeletionObject
|
||||
{
|
||||
BucketName = bucketName,
|
||||
Key = d.Key,
|
||||
Deleted = false
|
||||
}).ToList();
|
||||
}
|
||||
_logger.LogInformation("Delection object for bucket {BucketName} added to mongoDB", bucketName);
|
||||
try
|
||||
{
|
||||
var collection = _mongoDatabase.GetCollection<S3DeletionObject>("S3Delection");
|
||||
await collection.InsertManyAsync(deletionObject);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error occured while saving delection object for S3 to MogoDB");
|
||||
}
|
||||
_logger.LogInformation("Delection Objects added to MongoDB Successfully");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Master;
|
||||
using Marco.Pms.Model.Projects;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
@ -10,29 +11,43 @@ namespace Marco.Pms.Model.Activities
|
||||
public class TaskAllocation : TenantRelation
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
|
||||
public Guid? ParentTaskId { get; set; }
|
||||
public DateTime AssignmentDate { get; set; }
|
||||
public double PlannedTask { get; set; }
|
||||
public double CompletedTask { get; set; }
|
||||
public double ReportedTask { get; set; }
|
||||
public DateTime? ReportedDate { get; set; }
|
||||
|
||||
public DateTime? ApprovedDate { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
//public int? WorkItemMappingId { get; set; }
|
||||
//[ForeignKey("WorkItemMappingId")]
|
||||
//[ValidateNever]
|
||||
//public WorkItemMapping? WorkItemMapping { get; set; }
|
||||
public Guid AssignedBy { get; set; } //Employee Id
|
||||
|
||||
public Guid AssignedBy { get; set; } //Employee Id
|
||||
[ForeignKey("AssignedBy")]
|
||||
[ValidateNever]
|
||||
public Employee? Employee { get; set; }
|
||||
|
||||
public Guid? ReportedById { get; set; } //Employee Id
|
||||
|
||||
[ForeignKey("ReportedById")]
|
||||
[ValidateNever]
|
||||
public Employee? ReportedBy { get; set; }
|
||||
|
||||
public Guid? ApprovedById { get; set; } //Employee Id
|
||||
|
||||
[ForeignKey("ApprovedById")]
|
||||
[ValidateNever]
|
||||
public Employee? ApprovedBy { get; set; }
|
||||
|
||||
public Guid WorkItemId { get; set; }
|
||||
|
||||
[ForeignKey("WorkItemId")]
|
||||
[ValidateNever]
|
||||
public WorkItem? WorkItem { get; set; }
|
||||
|
||||
public Guid? WorkStatusId { get; set; }
|
||||
|
||||
[ForeignKey("WorkStatusId")]
|
||||
[ValidateNever]
|
||||
public WorkStatusMaster? WorkStatus { get; set; }
|
||||
}
|
||||
}
|
||||
|
12
Marco.Pms.Model/Activities/WorkStatusMaster.cs
Normal file
12
Marco.Pms.Model/Activities/WorkStatusMaster.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Marco.Pms.Model.Utilities;
|
||||
|
||||
namespace Marco.Pms.Model.Master
|
||||
{
|
||||
public class WorkStatusMaster : TenantRelation
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public bool IsSystem { get; set; } = false;
|
||||
}
|
||||
}
|
23
Marco.Pms.Model/AppMenu/MenuItem.cs
Normal file
23
Marco.Pms.Model/AppMenu/MenuItem.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Marco.Pms.Model.AppMenu
|
||||
{
|
||||
public class MenuItem
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public string? Text { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public bool Available { get; set; } = true;
|
||||
|
||||
public string? Link { get; set; }
|
||||
|
||||
// Changed from string → List<string>
|
||||
public List<string> PermissionIds { get; set; } = new List<string>();
|
||||
|
||||
public List<SubMenuItem> Submenu { get; set; } = new List<SubMenuItem>();
|
||||
}
|
||||
}
|
21
Marco.Pms.Model/AppMenu/MenuSection.cs
Normal file
21
Marco.Pms.Model/AppMenu/MenuSection.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Marco.Pms.Model.AppMenu
|
||||
{
|
||||
public class MenuSection
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public string? Header { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public List<MenuItem> Items { get; set; } = new List<MenuItem>();
|
||||
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid TenantId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
20
Marco.Pms.Model/AppMenu/SubMenuItem.cs
Normal file
20
Marco.Pms.Model/AppMenu/SubMenuItem.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Marco.Pms.Model.AppMenu
|
||||
{
|
||||
public class SubMenuItem
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.String)]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public string? Text { get; set; }
|
||||
public bool Available { get; set; } = true;
|
||||
|
||||
public string Link { get; set; } = string.Empty;
|
||||
|
||||
// Changed from string → List<string>
|
||||
public List<string> PermissionIds { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ namespace Marco.Pms.Model.Directory
|
||||
//public Guid? ProjectId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Designation { get; set; } = string.Empty;
|
||||
public string Organization { get; set; } = string.Empty;
|
||||
public string? Address { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
@ -20,6 +21,11 @@ namespace Marco.Pms.Model.Directory
|
||||
[ValidateNever]
|
||||
[ForeignKey("CreatedById")]
|
||||
public Employee? CreatedBy { get; set; }
|
||||
public Guid? UpdatedById { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey("UpdatedById")]
|
||||
public Employee? UpdatedBy { get; set; }
|
||||
|
||||
[DisplayName("ContactCategoryId")]
|
||||
public Guid? ContactCategoryId { get; set; }
|
||||
@ -27,5 +33,6 @@ namespace Marco.Pms.Model.Directory
|
||||
[ForeignKey(nameof(ContactCategoryId))]
|
||||
public ContactCategoryMaster? ContactCategory { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,13 @@ namespace Marco.Pms.Model.Directory
|
||||
[ValidateNever]
|
||||
[ForeignKey("CreatedById")]
|
||||
public Employee? Createdby { get; set; }
|
||||
public Guid? UpdatedById { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey("UpdatedById")]
|
||||
public Employee? UpdatedBy { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
public Guid ContactId { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
|
@ -1,4 +1,7 @@
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
|
||||
|
||||
namespace Marco.Pms.Model.DocumentManager
|
||||
{
|
||||
@ -16,10 +19,15 @@ namespace Marco.Pms.Model.DocumentManager
|
||||
/// </summary>
|
||||
public string? ThumbS3Key { get; set; }
|
||||
|
||||
public string? Base64Data { get; set; }
|
||||
public string? Base64Data { get; set; } = null;
|
||||
|
||||
public long FileSize { get; set; }
|
||||
public string ContentType { get; set; } = string.Empty;
|
||||
public Guid? UploadedById { get; set; }
|
||||
|
||||
[ValidateNever]
|
||||
[ForeignKey("UploadedById")]
|
||||
public Employee? UploadedBy { get; set; }
|
||||
public DateTime UploadedAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
13
Marco.Pms.Model/Dtos/Activities/ApproveTaskDto.cs
Normal file
13
Marco.Pms.Model/Dtos/Activities/ApproveTaskDto.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Marco.Pms.Model.Utilities;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Activities
|
||||
{
|
||||
public class ApproveTaskDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid WorkStatus { get; set; }
|
||||
public long ApprovedTask { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
public List<FileUploadModel>? Images { get; set; }
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
public class AssignTaskDto
|
||||
{
|
||||
public DateTime AssignmentDate { get; set; }
|
||||
public Guid? ParentTaskId { get; set; }
|
||||
public double PlannedTask { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public List<Guid>? TaskTeam { get; set; } //Employee Ids
|
||||
|
@ -0,0 +1,8 @@
|
||||
namespace Marco.Pms.Model.Dtos.Master
|
||||
{
|
||||
public class CreateWorkStatusMasterDto
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ namespace Marco.Pms.Model.Dtos.Activities
|
||||
public class ReportTaskDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid? ParentTaskId { get; set; }
|
||||
public double CompletedTask { get; set; }
|
||||
public DateTime ReportedDate { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
|
@ -0,0 +1,9 @@
|
||||
namespace Marco.Pms.Model.Dtos.Master
|
||||
{
|
||||
public class UpdateWorkStatusMasterDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
16
Marco.Pms.Model/Dtos/AppMenu/CreateMenuItemDto.cs
Normal file
16
Marco.Pms.Model/Dtos/AppMenu/CreateMenuItemDto.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace Marco.Pms.Model.Dtos.AppMenu
|
||||
{
|
||||
public class CreateMenuItemDto
|
||||
{
|
||||
public required string Text { get; set; }
|
||||
public required string Icon { get; set; }
|
||||
public bool Available { get; set; } = true;
|
||||
|
||||
public required string Link { get; set; }
|
||||
|
||||
// Changed from string → List<string>
|
||||
public List<string> PermissionIds { get; set; } = new List<string>();
|
||||
|
||||
public List<CreateSubMenuItemDto> Submenu { get; set; } = new List<CreateSubMenuItemDto>();
|
||||
}
|
||||
}
|
9
Marco.Pms.Model/Dtos/AppMenu/CreateMenuSectionDto.cs
Normal file
9
Marco.Pms.Model/Dtos/AppMenu/CreateMenuSectionDto.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Marco.Pms.Model.Dtos.AppMenu
|
||||
{
|
||||
public class CreateMenuSectionDto
|
||||
{
|
||||
public required string Header { get; set; }
|
||||
public required string Title { get; set; }
|
||||
public List<CreateMenuItemDto> Items { get; set; } = new List<CreateMenuItemDto>();
|
||||
}
|
||||
}
|
13
Marco.Pms.Model/Dtos/AppMenu/CreateSubMenuItemDto.cs
Normal file
13
Marco.Pms.Model/Dtos/AppMenu/CreateSubMenuItemDto.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Marco.Pms.Model.Dtos.AppMenu
|
||||
{
|
||||
public class CreateSubMenuItemDto
|
||||
{
|
||||
public required string Text { get; set; }
|
||||
public bool Available { get; set; } = true;
|
||||
|
||||
public required string Link { get; set; } = string.Empty;
|
||||
|
||||
// Changed from string → List<string>
|
||||
public List<string> PermissionIds { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
16
Marco.Pms.Model/Dtos/AppMenu/UpdateMenuItemDto.cs
Normal file
16
Marco.Pms.Model/Dtos/AppMenu/UpdateMenuItemDto.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace Marco.Pms.Model.Dtos.AppMenu
|
||||
{
|
||||
public class UpdateMenuItemDto
|
||||
{
|
||||
public required Guid Id { get; set; }
|
||||
|
||||
public required string Text { get; set; }
|
||||
public required string Icon { get; set; }
|
||||
public bool Available { get; set; } = true;
|
||||
|
||||
public required string Link { get; set; }
|
||||
|
||||
// Changed from string → List<string>
|
||||
public List<string> PermissionIds { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
9
Marco.Pms.Model/Dtos/AppMenu/UpdateMenuSectionDto.cs
Normal file
9
Marco.Pms.Model/Dtos/AppMenu/UpdateMenuSectionDto.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Marco.Pms.Model.Dtos.AppMenu
|
||||
{
|
||||
public class UpdateMenuSectionDto
|
||||
{
|
||||
public required Guid Id { get; set; }
|
||||
public required string Header { get; set; }
|
||||
public required string Title { get; set; }
|
||||
}
|
||||
}
|
15
Marco.Pms.Model/Dtos/AppMenu/UpdateSubMenuItemDto.cs
Normal file
15
Marco.Pms.Model/Dtos/AppMenu/UpdateSubMenuItemDto.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace Marco.Pms.Model.Dtos.AppMenu
|
||||
{
|
||||
public class UpdateSubMenuItemDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string? Text { get; set; }
|
||||
public bool Available { get; set; } = true;
|
||||
|
||||
public string Link { get; set; } = string.Empty;
|
||||
|
||||
// Changed from string → List<string>
|
||||
public List<string> PermissionIds { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
public List<Guid>? BucketIds { get; set; }
|
||||
public Guid? ContactCategoryId { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? Designation { get; set; }
|
||||
public string? Organization { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public List<ContactTagDto>? Tags { get; set; }
|
||||
|
@ -10,6 +10,7 @@
|
||||
public List<Guid>? BucketIds { get; set; }
|
||||
public Guid? ContactCategoryId { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public string? Designation { get; set; }
|
||||
public string? Organization { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public List<ContactTagDto>? Tags { get; set; }
|
||||
|
10
Marco.Pms.Model/Dtos/DocumentManager/DocumentBatchDto.cs
Normal file
10
Marco.Pms.Model/Dtos/DocumentManager/DocumentBatchDto.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using Marco.Pms.Model.DocumentManager;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.DocumentManager
|
||||
{
|
||||
public class DocumentBatchDto
|
||||
{
|
||||
public Guid? BatchId { get; set; }
|
||||
public List<Document>? Documents { get; set; }
|
||||
}
|
||||
}
|
22
Marco.Pms.Model/Dtos/Expenses/CreateExpensesDto.cs
Normal file
22
Marco.Pms.Model/Dtos/Expenses/CreateExpensesDto.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Marco.Pms.Model.Utilities;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Expenses
|
||||
{
|
||||
public class CreateExpensesDto
|
||||
{
|
||||
public required Guid ProjectId { get; set; }
|
||||
public required Guid ExpensesTypeId { get; set; }
|
||||
public required Guid PaymentModeId { get; set; }
|
||||
public required Guid PaidById { get; set; }
|
||||
public DateTime TransactionDate { get; set; } = DateTime.Now;
|
||||
public string? TransactionId { get; set; }
|
||||
public required string Description { get; set; }
|
||||
public string? Location { get; set; }
|
||||
public string? GSTNumber { get; set; }
|
||||
public required string SupplerName { get; set; }
|
||||
public required double Amount { get; set; }
|
||||
public int? NoOfPersons { get; set; } = 0;
|
||||
public bool PreApproved { get; set; } = false;
|
||||
public required List<FileUploadModel> BillAttachments { get; set; }
|
||||
}
|
||||
}
|
12
Marco.Pms.Model/Dtos/Expenses/ExpenseRecordDto.cs
Normal file
12
Marco.Pms.Model/Dtos/Expenses/ExpenseRecordDto.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace Marco.Pms.Model.Dtos.Expenses
|
||||
{
|
||||
public class ExpenseRecordDto
|
||||
{
|
||||
public Guid ExpenseId { get; set; }
|
||||
public Guid StatusId { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
public string? ReimburseTransactionId { get; set; }
|
||||
public DateTime? ReimburseDate { get; set; }
|
||||
public Guid? ReimburseById { get; set; }
|
||||
}
|
||||
}
|
23
Marco.Pms.Model/Dtos/Expenses/UpdateExpensesDto.cs
Normal file
23
Marco.Pms.Model/Dtos/Expenses/UpdateExpensesDto.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Marco.Pms.Model.Utilities;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Expenses
|
||||
{
|
||||
public class UpdateExpensesDto
|
||||
{
|
||||
public required Guid Id { get; set; }
|
||||
public required Guid ProjectId { get; set; }
|
||||
public required Guid ExpensesTypeId { get; set; }
|
||||
public required Guid PaymentModeId { get; set; }
|
||||
public required Guid PaidById { get; set; }
|
||||
public DateTime TransactionDate { get; set; } = DateTime.Now;
|
||||
public string? TransactionId { get; set; }
|
||||
public required string Description { get; set; }
|
||||
public string? Location { get; set; }
|
||||
public string? GSTNumber { get; set; }
|
||||
public required string SupplerName { get; set; }
|
||||
public required double Amount { get; set; }
|
||||
public int? NoOfPersons { get; set; } = 0;
|
||||
public bool PreApproved { get; set; } = false;
|
||||
public List<FileUploadModel>? BillAttachments { get; set; }
|
||||
}
|
||||
}
|
12
Marco.Pms.Model/Dtos/Master/ExpensesStatusMasterDto.cs
Normal file
12
Marco.Pms.Model/Dtos/Master/ExpensesStatusMasterDto.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace Marco.Pms.Model.Dtos.Master
|
||||
{
|
||||
public class ExpensesStatusMasterDto
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public required string Name { get; set; } = string.Empty;
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public List<Guid>? PermissionIds { get; set; }
|
||||
public required string? Color { get; set; }
|
||||
}
|
||||
}
|
10
Marco.Pms.Model/Dtos/Master/ExpensesTypeMasterDto.cs
Normal file
10
Marco.Pms.Model/Dtos/Master/ExpensesTypeMasterDto.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Marco.Pms.Model.Dtos.Master
|
||||
{
|
||||
public class ExpensesTypeMasterDto
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public required bool NoOfPersonsRequired { get; set; }
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
}
|
9
Marco.Pms.Model/Dtos/Master/PaymentModeMatserDto.cs
Normal file
9
Marco.Pms.Model/Dtos/Master/PaymentModeMatserDto.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Marco.Pms.Model.Dtos.Master
|
||||
{
|
||||
public class PaymentModeMatserDto
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class BuildingDot
|
||||
public class BuildingDto
|
||||
{
|
||||
[Key]
|
||||
public Guid? Id { get; set; }
|
@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class FloorDot
|
||||
public class FloorDto
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
|
@ -1,9 +0,0 @@
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class InfraDot
|
||||
{
|
||||
public BuildingDot? Building { get; set; }
|
||||
public FloorDot? Floor { get; set; }
|
||||
public WorkAreaDot? WorkArea { get; set; }
|
||||
}
|
||||
}
|
9
Marco.Pms.Model/Dtos/Projects/InfraDto.cs
Normal file
9
Marco.Pms.Model/Dtos/Projects/InfraDto.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class InfraDto
|
||||
{
|
||||
public BuildingDto? Building { get; set; }
|
||||
public FloorDto? Floor { get; set; }
|
||||
public WorkAreaDto? WorkArea { get; set; }
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
public Guid EmpID { get; set; }
|
||||
public Guid JobRoleId { get; set; }
|
||||
public Guid ProjectId { get; set; }
|
||||
|
||||
public bool Status { get; set; }
|
||||
}
|
||||
|
||||
@ -14,7 +13,6 @@
|
||||
{
|
||||
public Guid ProjectId { get; set; }
|
||||
public Guid JobRoleId { get; set; }
|
||||
|
||||
public bool Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Marco.Pms.Model.Dtos.Project
|
||||
{
|
||||
public class WorkAreaDot
|
||||
public class WorkAreaDto
|
||||
{
|
||||
[Key]
|
||||
public Guid? Id { get; set; }
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user