Document_Manager #129

Merged
ashutosh.nehete merged 83 commits from Document_Manager into main 2025-09-11 04:12:01 +00:00
11 changed files with 7034 additions and 0 deletions
Showing only changes of commit 535a9924cc - Show all commits

View File

@ -108,6 +108,14 @@ namespace Marco.Pms.DataAccess.Data
public DbSet<StatusPermissionMapping> StatusPermissionMapping { get; set; }
public DbSet<ExpensesStatusMapping> ExpensesStatusMapping { get; set; }
public DbSet<EntityTypeMaster> EntityTypeMasters { get; set; }
public DbSet<DocumentTypeMaster> DocumentTypeMasters { get; set; }
public DbSet<DocumentCategoryMaster> DocumentCategoryMasters { get; set; }
public DbSet<DocumentTagMaster> DocumentTagMasters { get; set; }
public DbSet<DocumentAttachment> DocumentAttachments { get; set; }
public DbSet<DocumentAttachmentMapping> DocumentAttachmentMappings { get; set; }
public DbSet<AttachmentVersionMapping> AttachmentVersionMappings { get; set; }
public DbSet<AttachmentTagMapping> AttachmentTagMappings { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
@ -720,6 +728,205 @@ namespace Marco.Pms.DataAccess.Data
}
);
modelBuilder.Entity<EntityTypeMaster>().HasData(
new EntityTypeMaster
{
Id = Guid.Parse("c8fe7115-aa27-43bc-99f4-7b05fabe436e"),
Name = "Project Entity",
Description = "Emtities related to project."
},
new EntityTypeMaster
{
Id = Guid.Parse("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7"),
Name = "Employee Entity",
Description = "Employee related entitie",
}
);
modelBuilder.Entity<DocumentCategoryMaster>().HasData(
new DocumentCategoryMaster
{
Id = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
Name = "Project Documents",
Description = "Project documents are formal records that outline the plans, progress, and details necessary to execute and manage a project effectively.",
EntityTypeId = Guid.Parse("c8fe7115-aa27-43bc-99f4-7b05fabe436e"),
CreatedAt = DateTime.UtcNow,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentCategoryMaster
{
Id = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
Name = "Employee Documents",
Description = "Employment details along with legal IDs like passports or drivers licenses to verify identity and work authorization.",
EntityTypeId = Guid.Parse("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7"),
CreatedAt = DateTime.UtcNow,
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
);
modelBuilder.Entity<DocumentTypeMaster>().HasData(
new DocumentTypeMaster
{
Id = Guid.Parse("336225ac-67f3-4e14-ba7a-8fad03cf2832"),
Name = "Aadhaar card",
RegexExpression = "^[2-9][0-9]{11}$",
AllowedContentType = "application/pdf",
MaxSizeAllowedInMB = 2,
IsValidationRequired = true,
IsMandatory = true,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("6344393b-9bb1-45f8-b620-9f6e279d012c"),
Name = "Pan Card",
RegexExpression = "^[A-Z]{5}[0-9]{4}[A-Z]{1}$",
AllowedContentType = "application/pdf",
MaxSizeAllowedInMB = 2,
IsValidationRequired = true,
IsMandatory = true,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("2d1d7441-46a8-425e-9395-94d0956f8e91"),
Name = "Voter Card",
RegexExpression = "^[A-Z]{3}[0-9]{7}$",
AllowedContentType = "application/pdf",
MaxSizeAllowedInMB = 2,
IsValidationRequired = true,
IsMandatory = true,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("16c40b80-c207-4a0c-a4d3-381414afe35a"),
Name = "Passport",
RegexExpression = "^[A-PR-WY][1-9]\\d\\s?\\d{4}[1-9]$",
AllowedContentType = "application/pdf",
MaxSizeAllowedInMB = 2,
IsValidationRequired = true,
IsMandatory = true,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("f76d8215-d399-4f0e-b414-12e427f50be3"),
Name = "Bank Passbook",
RegexExpression = "^\\d{9,18}$",
AllowedContentType = "application/pdf",
MaxSizeAllowedInMB = 2,
IsValidationRequired = true,
IsMandatory = true,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("260abd7e-c96d-4ae4-a29b-9b5bb5d24ebd"),
Name = "Bill of Quantities (BOQ)",
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
MaxSizeAllowedInMB = 1,
IsValidationRequired = false,
IsMandatory = false,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("a1a190ba-c4a8-432f-b26d-1231ca1d44bc"),
Name = "Work Order",
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
MaxSizeAllowedInMB = 1,
IsValidationRequired = false,
IsMandatory = false,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("07ca7182-9ac0-4407-b988-59901170cb86"),
Name = "Letter of Agreement",
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
MaxSizeAllowedInMB = 1,
IsValidationRequired = false,
IsMandatory = false,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("846e89a9-5735-45ec-a21d-c97f85a94ada"),
Name = "Health and Safety Document",
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
MaxSizeAllowedInMB = 1,
IsValidationRequired = false,
IsMandatory = false,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("7cc41c91-23cb-442b-badd-f932138d149f"),
Name = "Standard Operating Procedure (SOP)",
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
MaxSizeAllowedInMB = 1,
IsValidationRequired = false,
IsMandatory = false,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
},
new DocumentTypeMaster
{
Id = Guid.Parse("5668de00-5d84-47f7-b9b5-7fefd1219f05"),
Name = "Drawings",
AllowedContentType = "application/pdf,image/vnd.dwg,application/acad",
MaxSizeAllowedInMB = 20,
IsValidationRequired = false,
IsMandatory = false,
CreatedAt = DateTime.UtcNow,
IsSystem = true,
IsActive = true,
DocumentCategoryId = Guid.Parse("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
TenantId = Guid.Parse("b3466e83-7e11-464c-b93a-daf047838b26")
}
);
modelBuilder.Entity<SubscriptionStatus>().HasData(
new SubscriptionStatus
{
@ -777,6 +984,7 @@ namespace Marco.Pms.DataAccess.Data
// Employee Module
new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Employee Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
new Feature { Id = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), Description = "Manage Document", Name = "Document Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true },
new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Managing all directory related rights", Name = "Directory Management", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true },
@ -817,6 +1025,13 @@ namespace Marco.Pms.DataAccess.Data
new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency" },
new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" },
//Document Management Feature
new FeaturePermission { Id = new Guid("71189504-f1c8-4ca5-8db6-810497be2854"), FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), IsEnabled = true, Name = "View Document", Description = "Grants a user the authority to view all documents related to employees and projects" },
new FeaturePermission { Id = new Guid("3f6d1f67-6fa5-4b7c-b17b-018d4fe4aab8"), FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), IsEnabled = true, Name = "Upload Document", Description = "Grants a user the authority to upload the document" },
new FeaturePermission { Id = new Guid("c423fd81-6273-4b9d-bb5e-76a0fb343833"), FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), IsEnabled = true, Name = "Mofify Document", Description = "Grants a user the authority to modify document" },
new FeaturePermission { Id = new Guid("40863a13-5a66-469d-9b48-135bc5dbf486"), FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), IsEnabled = true, Name = "Delete Document", Description = "Grants a user the authority to delete the document" },
new FeaturePermission { Id = new Guid("13a1f30f-38d1-41bf-8e7a-b75189aab8e0"), FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), IsEnabled = true, Name = "Verify Document", Description = "Grants a user the authority to verify the document" },
// Directory Management Feature
new FeaturePermission { Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Admin", Description = "Full control over all directories, including the ability to manage permissions for all directories in the system." },
new FeaturePermission { Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Manager", Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories." },

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,488 @@
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_Document_Manager_Tables : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DocumentTagMasters",
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"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_DocumentTagMasters", x => x.Id);
table.ForeignKey(
name: "FK_DocumentTagMasters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "EntityTypeMasters",
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")
},
constraints: table =>
{
table.PrimaryKey("PK_EntityTypeMasters", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DocumentCategoryMasters",
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"),
EntityTypeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_DocumentCategoryMasters", x => x.Id);
table.ForeignKey(
name: "FK_DocumentCategoryMasters_EntityTypeMasters_EntityTypeId",
column: x => x.EntityTypeId,
principalTable: "EntityTypeMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DocumentCategoryMasters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DocumentTypeMasters",
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"),
RegexExpression = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
AllowedContentType = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
MaxSizeAllowedInMB = table.Column<double>(type: "double", nullable: false),
IsValidationRequired = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsMandatory = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsSystem = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false),
DocumentCategoryId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
TenantId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_DocumentTypeMasters", x => x.Id);
table.ForeignKey(
name: "FK_DocumentTypeMasters_DocumentCategoryMasters_DocumentCategory~",
column: x => x.DocumentCategoryId,
principalTable: "DocumentCategoryMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DocumentTypeMasters_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DocumentAttachments",
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"),
DocumentId = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
UploadedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UploadedById = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpdatedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
VerifiedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
IsVerified = table.Column<bool>(type: "tinyint(1)", nullable: true),
VerifiedById = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
EntityId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DocumentTypeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
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_DocumentAttachments", x => x.Id);
table.ForeignKey(
name: "FK_DocumentAttachments_DocumentTypeMasters_DocumentTypeId",
column: x => x.DocumentTypeId,
principalTable: "DocumentTypeMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DocumentAttachments_Employees_UpdatedById",
column: x => x.UpdatedById,
principalTable: "Employees",
principalColumn: "Id");
table.ForeignKey(
name: "FK_DocumentAttachments_Employees_UploadedById",
column: x => x.UploadedById,
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DocumentAttachments_Employees_VerifiedById",
column: x => x.VerifiedById,
principalTable: "Employees",
principalColumn: "Id");
table.ForeignKey(
name: "FK_DocumentAttachments_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "AttachmentTagMappings",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DocumentTagId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
AttachmentId = 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_AttachmentTagMappings", x => x.Id);
table.ForeignKey(
name: "FK_AttachmentTagMappings_DocumentAttachments_AttachmentId",
column: x => x.AttachmentId,
principalTable: "DocumentAttachments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttachmentTagMappings_DocumentTagMasters_DocumentTagId",
column: x => x.DocumentTagId,
principalTable: "DocumentTagMasters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttachmentTagMappings_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "AttachmentVersionMappings",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ParentAttachmentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Version = table.Column<int>(type: "int", nullable: false),
ChildAttachmentId = 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_AttachmentVersionMappings", x => x.Id);
table.ForeignKey(
name: "FK_AttachmentVersionMappings_DocumentAttachments_ChildAttachmen~",
column: x => x.ChildAttachmentId,
principalTable: "DocumentAttachments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttachmentVersionMappings_DocumentAttachments_ParentAttachme~",
column: x => x.ParentAttachmentId,
principalTable: "DocumentAttachments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AttachmentVersionMappings_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "DocumentAttachmentMappings",
columns: table => new
{
Id = 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"),
AttachmentId = 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_DocumentAttachmentMappings", x => x.Id);
table.ForeignKey(
name: "FK_DocumentAttachmentMappings_DocumentAttachments_AttachmentId",
column: x => x.AttachmentId,
principalTable: "DocumentAttachments",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DocumentAttachmentMappings_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DocumentAttachmentMappings_Tenants_TenantId",
column: x => x.TenantId,
principalTable: "Tenants",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "EntityTypeMasters",
columns: new[] { "Id", "Description", "Name" },
values: new object[,]
{
{ new Guid("c8fe7115-aa27-43bc-99f4-7b05fabe436e"), "Emtities related to project.", "Project Entity" },
{ new Guid("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7"), "Employee related entitie", "Employee Entity" }
});
migrationBuilder.InsertData(
table: "Features",
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
values: new object[] { new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), "Manage Document", true, new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), "Document Management" });
migrationBuilder.InsertData(
table: "DocumentCategoryMasters",
columns: new[] { "Id", "CreatedAt", "Description", "EntityTypeId", "Name", "TenantId" },
values: new object[,]
{
{ new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"), new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8157), "Employment details along with legal IDs like passports or drivers licenses to verify identity and work authorization.", new Guid("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7"), "Employee Documents", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"), new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8150), "Project documents are formal records that outline the plans, progress, and details necessary to execute and manage a project effectively.", new Guid("c8fe7115-aa27-43bc-99f4-7b05fabe436e"), "Project Documents", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.InsertData(
table: "FeaturePermissions",
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
values: new object[,]
{
{ new Guid("13a1f30f-38d1-41bf-8e7a-b75189aab8e0"), "Grants a user the authority to verify the document", new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), true, "Verify Document" },
{ new Guid("3f6d1f67-6fa5-4b7c-b17b-018d4fe4aab8"), "Grants a user the authority to upload the document", new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), true, "Upload Document" },
{ new Guid("40863a13-5a66-469d-9b48-135bc5dbf486"), "Grants a user the authority to delete the document", new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), true, "Delete Document" },
{ new Guid("71189504-f1c8-4ca5-8db6-810497be2854"), "Grants a user the authority to view all documents related to employees and projects", new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), true, "View Document" },
{ new Guid("c423fd81-6273-4b9d-bb5e-76a0fb343833"), "Grants a user the authority to modify document", new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"), true, "Mofify Document" }
});
migrationBuilder.InsertData(
table: "DocumentTypeMasters",
columns: new[] { "Id", "AllowedContentType", "CreatedAt", "DocumentCategoryId", "IsActive", "IsMandatory", "IsSystem", "IsValidationRequired", "MaxSizeAllowedInMB", "Name", "RegexExpression", "TenantId" },
values: new object[,]
{
{ new Guid("07ca7182-9ac0-4407-b988-59901170cb86"), "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8229), new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"), true, false, true, false, 1.0, "Letter of Agreement", null, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("16c40b80-c207-4a0c-a4d3-381414afe35a"), "application/pdf", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8216), new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"), true, true, true, true, 2.0, "Passport", "^[A-PR-WY][1-9]\\d\\s?\\d{4}[1-9]$", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("260abd7e-c96d-4ae4-a29b-9b5bb5d24ebd"), "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8222), new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"), true, false, true, false, 1.0, "Bill of Quantities (BOQ)", null, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("2d1d7441-46a8-425e-9395-94d0956f8e91"), "application/pdf", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8212), new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"), true, true, true, true, 2.0, "Voter Card", "^[A-Z]{3}[0-9]{7}$", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("336225ac-67f3-4e14-ba7a-8fad03cf2832"), "application/pdf", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8204), new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"), true, true, true, true, 2.0, "Aadhaar card", "^[2-9][0-9]{11}$", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("5668de00-5d84-47f7-b9b5-7fefd1219f05"), "application/pdf,image/vnd.dwg,application/acad", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8238), new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"), true, false, true, false, 20.0, "Drawings", null, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("6344393b-9bb1-45f8-b620-9f6e279d012c"), "application/pdf", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8209), new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"), true, true, true, true, 2.0, "Pan Card", "^[A-Z]{5}[0-9]{4}[A-Z]{1}$", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("7cc41c91-23cb-442b-badd-f932138d149f"), "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8235), new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"), true, false, true, false, 1.0, "Standard Operating Procedure (SOP)", null, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("846e89a9-5735-45ec-a21d-c97f85a94ada"), "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8232), new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"), true, false, true, false, 1.0, "Health and Safety Document", null, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("a1a190ba-c4a8-432f-b26d-1231ca1d44bc"), "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8226), new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"), true, false, true, false, 1.0, "Work Order", null, new Guid("b3466e83-7e11-464c-b93a-daf047838b26") },
{ new Guid("f76d8215-d399-4f0e-b414-12e427f50be3"), "application/pdf", new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8219), new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"), true, true, true, true, 2.0, "Bank Passbook", "^\\d{9,18}$", new Guid("b3466e83-7e11-464c-b93a-daf047838b26") }
});
migrationBuilder.CreateIndex(
name: "IX_AttachmentTagMappings_AttachmentId",
table: "AttachmentTagMappings",
column: "AttachmentId");
migrationBuilder.CreateIndex(
name: "IX_AttachmentTagMappings_DocumentTagId",
table: "AttachmentTagMappings",
column: "DocumentTagId");
migrationBuilder.CreateIndex(
name: "IX_AttachmentTagMappings_TenantId",
table: "AttachmentTagMappings",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_AttachmentVersionMappings_ChildAttachmentId",
table: "AttachmentVersionMappings",
column: "ChildAttachmentId");
migrationBuilder.CreateIndex(
name: "IX_AttachmentVersionMappings_ParentAttachmentId",
table: "AttachmentVersionMappings",
column: "ParentAttachmentId");
migrationBuilder.CreateIndex(
name: "IX_AttachmentVersionMappings_TenantId",
table: "AttachmentVersionMappings",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachmentMappings_AttachmentId",
table: "DocumentAttachmentMappings",
column: "AttachmentId");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachmentMappings_DocumentId",
table: "DocumentAttachmentMappings",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachmentMappings_TenantId",
table: "DocumentAttachmentMappings",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachments_DocumentTypeId",
table: "DocumentAttachments",
column: "DocumentTypeId");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachments_TenantId",
table: "DocumentAttachments",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachments_UpdatedById",
table: "DocumentAttachments",
column: "UpdatedById");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachments_UploadedById",
table: "DocumentAttachments",
column: "UploadedById");
migrationBuilder.CreateIndex(
name: "IX_DocumentAttachments_VerifiedById",
table: "DocumentAttachments",
column: "VerifiedById");
migrationBuilder.CreateIndex(
name: "IX_DocumentCategoryMasters_EntityTypeId",
table: "DocumentCategoryMasters",
column: "EntityTypeId");
migrationBuilder.CreateIndex(
name: "IX_DocumentCategoryMasters_TenantId",
table: "DocumentCategoryMasters",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_DocumentTagMasters_TenantId",
table: "DocumentTagMasters",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_DocumentTypeMasters_DocumentCategoryId",
table: "DocumentTypeMasters",
column: "DocumentCategoryId");
migrationBuilder.CreateIndex(
name: "IX_DocumentTypeMasters_TenantId",
table: "DocumentTypeMasters",
column: "TenantId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AttachmentTagMappings");
migrationBuilder.DropTable(
name: "AttachmentVersionMappings");
migrationBuilder.DropTable(
name: "DocumentAttachmentMappings");
migrationBuilder.DropTable(
name: "DocumentTagMasters");
migrationBuilder.DropTable(
name: "DocumentAttachments");
migrationBuilder.DropTable(
name: "DocumentTypeMasters");
migrationBuilder.DropTable(
name: "DocumentCategoryMasters");
migrationBuilder.DropTable(
name: "EntityTypeMasters");
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("13a1f30f-38d1-41bf-8e7a-b75189aab8e0"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("3f6d1f67-6fa5-4b7c-b17b-018d4fe4aab8"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("40863a13-5a66-469d-9b48-135bc5dbf486"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("71189504-f1c8-4ca5-8db6-810497be2854"));
migrationBuilder.DeleteData(
table: "FeaturePermissions",
keyColumn: "Id",
keyValue: new Guid("c423fd81-6273-4b9d-bb5e-76a0fb343833"));
migrationBuilder.DeleteData(
table: "Features",
keyColumn: "Id",
keyValue: new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"));
}
}
}

View File

@ -720,6 +720,61 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("EmployeeBucketMappings");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.AttachmentTagMapping", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid>("AttachmentId")
.HasColumnType("char(36)");
b.Property<Guid>("DocumentTagId")
.HasColumnType("char(36)");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("AttachmentId");
b.HasIndex("DocumentTagId");
b.HasIndex("TenantId");
b.ToTable("AttachmentTagMappings");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.AttachmentVersionMapping", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid>("ChildAttachmentId")
.HasColumnType("char(36)");
b.Property<Guid>("ParentAttachmentId")
.HasColumnType("char(36)");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.Property<int>("Version")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ChildAttachmentId");
b.HasIndex("ParentAttachmentId");
b.HasIndex("TenantId");
b.ToTable("AttachmentVersionMappings");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b =>
{
b.Property<Guid>("Id")
@ -768,6 +823,384 @@ namespace Marco.Pms.DataAccess.Migrations
b.ToTable("Documents");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentAttachment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("DocumentId")
.HasColumnType("longtext");
b.Property<Guid>("DocumentTypeId")
.HasColumnType("char(36)");
b.Property<Guid>("EntityId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<bool?>("IsVerified")
.HasColumnType("tinyint(1)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("datetime(6)");
b.Property<Guid?>("UpdatedById")
.HasColumnType("char(36)");
b.Property<DateTime>("UploadedAt")
.HasColumnType("datetime(6)");
b.Property<Guid>("UploadedById")
.HasColumnType("char(36)");
b.Property<DateTime>("VerifiedAt")
.HasColumnType("datetime(6)");
b.Property<Guid?>("VerifiedById")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("DocumentTypeId");
b.HasIndex("TenantId");
b.HasIndex("UpdatedById");
b.HasIndex("UploadedById");
b.HasIndex("VerifiedById");
b.ToTable("DocumentAttachments");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentAttachmentMapping", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<Guid>("AttachmentId")
.HasColumnType("char(36)");
b.Property<Guid>("DocumentId")
.HasColumnType("char(36)");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("AttachmentId");
b.HasIndex("DocumentId");
b.HasIndex("TenantId");
b.ToTable("DocumentAttachmentMappings");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentCategoryMaster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("EntityTypeId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("EntityTypeId");
b.HasIndex("TenantId");
b.ToTable("DocumentCategoryMasters");
b.HasData(
new
{
Id = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8150),
Description = "Project documents are formal records that outline the plans, progress, and details necessary to execute and manage a project effectively.",
EntityTypeId = new Guid("c8fe7115-aa27-43bc-99f4-7b05fabe436e"),
Name = "Project Documents",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8157),
Description = "Employment details along with legal IDs like passports or drivers licenses to verify identity and work authorization.",
EntityTypeId = new Guid("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7"),
Name = "Employee Documents",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
});
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentTagMaster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("TenantId");
b.ToTable("DocumentTagMasters");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentTypeMaster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("AllowedContentType")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<Guid>("DocumentCategoryId")
.HasColumnType("char(36)");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsMandatory")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSystem")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsValidationRequired")
.HasColumnType("tinyint(1)");
b.Property<double>("MaxSizeAllowedInMB")
.HasColumnType("double");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("RegexExpression")
.HasColumnType("longtext");
b.Property<Guid>("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("DocumentCategoryId");
b.HasIndex("TenantId");
b.ToTable("DocumentTypeMasters");
b.HasData(
new
{
Id = new Guid("336225ac-67f3-4e14-ba7a-8fad03cf2832"),
AllowedContentType = "application/pdf",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8204),
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
IsActive = true,
IsMandatory = true,
IsSystem = true,
IsValidationRequired = true,
MaxSizeAllowedInMB = 2.0,
Name = "Aadhaar card",
RegexExpression = "^[2-9][0-9]{11}$",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("6344393b-9bb1-45f8-b620-9f6e279d012c"),
AllowedContentType = "application/pdf",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8209),
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
IsActive = true,
IsMandatory = true,
IsSystem = true,
IsValidationRequired = true,
MaxSizeAllowedInMB = 2.0,
Name = "Pan Card",
RegexExpression = "^[A-Z]{5}[0-9]{4}[A-Z]{1}$",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("2d1d7441-46a8-425e-9395-94d0956f8e91"),
AllowedContentType = "application/pdf",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8212),
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
IsActive = true,
IsMandatory = true,
IsSystem = true,
IsValidationRequired = true,
MaxSizeAllowedInMB = 2.0,
Name = "Voter Card",
RegexExpression = "^[A-Z]{3}[0-9]{7}$",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("16c40b80-c207-4a0c-a4d3-381414afe35a"),
AllowedContentType = "application/pdf",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8216),
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
IsActive = true,
IsMandatory = true,
IsSystem = true,
IsValidationRequired = true,
MaxSizeAllowedInMB = 2.0,
Name = "Passport",
RegexExpression = "^[A-PR-WY][1-9]\\d\\s?\\d{4}[1-9]$",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("f76d8215-d399-4f0e-b414-12e427f50be3"),
AllowedContentType = "application/pdf",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8219),
DocumentCategoryId = new Guid("2d9fb9cf-db53-476b-a452-492e88e2b51f"),
IsActive = true,
IsMandatory = true,
IsSystem = true,
IsValidationRequired = true,
MaxSizeAllowedInMB = 2.0,
Name = "Bank Passbook",
RegexExpression = "^\\d{9,18}$",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("260abd7e-c96d-4ae4-a29b-9b5bb5d24ebd"),
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8222),
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
IsActive = true,
IsMandatory = false,
IsSystem = true,
IsValidationRequired = false,
MaxSizeAllowedInMB = 1.0,
Name = "Bill of Quantities (BOQ)",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("a1a190ba-c4a8-432f-b26d-1231ca1d44bc"),
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8226),
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
IsActive = true,
IsMandatory = false,
IsSystem = true,
IsValidationRequired = false,
MaxSizeAllowedInMB = 1.0,
Name = "Work Order",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("07ca7182-9ac0-4407-b988-59901170cb86"),
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8229),
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
IsActive = true,
IsMandatory = false,
IsSystem = true,
IsValidationRequired = false,
MaxSizeAllowedInMB = 1.0,
Name = "Letter of Agreement",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("846e89a9-5735-45ec-a21d-c97f85a94ada"),
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8232),
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
IsActive = true,
IsMandatory = false,
IsSystem = true,
IsValidationRequired = false,
MaxSizeAllowedInMB = 1.0,
Name = "Health and Safety Document",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("7cc41c91-23cb-442b-badd-f932138d149f"),
AllowedContentType = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8235),
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
IsActive = true,
IsMandatory = false,
IsSystem = true,
IsValidationRequired = false,
MaxSizeAllowedInMB = 1.0,
Name = "Standard Operating Procedure (SOP)",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
},
new
{
Id = new Guid("5668de00-5d84-47f7-b9b5-7fefd1219f05"),
AllowedContentType = "application/pdf,image/vnd.dwg,application/acad",
CreatedAt = new DateTime(2025, 8, 28, 5, 50, 2, 39, DateTimeKind.Utc).AddTicks(8238),
DocumentCategoryId = new Guid("cfbff269-072b-477a-b48b-72cdc57dd1d3"),
IsActive = true,
IsMandatory = false,
IsSystem = true,
IsValidationRequired = false,
MaxSizeAllowedInMB = 20.0,
Name = "Drawings",
TenantId = new Guid("b3466e83-7e11-464c-b93a-daf047838b26")
});
});
modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b =>
{
b.Property<Guid>("Id")
@ -1139,6 +1572,46 @@ namespace Marco.Pms.DataAccess.Migrations
Name = "Manage Masters"
},
new
{
Id = new Guid("71189504-f1c8-4ca5-8db6-810497be2854"),
Description = "Grants a user the authority to view all documents related to employees and projects",
FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"),
IsEnabled = true,
Name = "View Document"
},
new
{
Id = new Guid("3f6d1f67-6fa5-4b7c-b17b-018d4fe4aab8"),
Description = "Grants a user the authority to upload the document",
FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"),
IsEnabled = true,
Name = "Upload Document"
},
new
{
Id = new Guid("c423fd81-6273-4b9d-bb5e-76a0fb343833"),
Description = "Grants a user the authority to modify document",
FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"),
IsEnabled = true,
Name = "Mofify Document"
},
new
{
Id = new Guid("40863a13-5a66-469d-9b48-135bc5dbf486"),
Description = "Grants a user the authority to delete the document",
FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"),
IsEnabled = true,
Name = "Delete Document"
},
new
{
Id = new Guid("13a1f30f-38d1-41bf-8e7a-b75189aab8e0"),
Description = "Grants a user the authority to verify the document",
FeatureId = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"),
IsEnabled = true,
Name = "Verify Document"
},
new
{
Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"),
Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.",
@ -1961,6 +2434,39 @@ namespace Marco.Pms.DataAccess.Migrations
});
});
modelBuilder.Entity("Marco.Pms.Model.Master.EntityTypeMaster", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("EntityTypeMasters");
b.HasData(
new
{
Id = new Guid("c8fe7115-aa27-43bc-99f4-7b05fabe436e"),
Description = "Emtities related to project.",
Name = "Project Entity"
},
new
{
Id = new Guid("dbb9555a-7a0c-40f2-a9ed-f0463f1ceed7"),
Description = "Employee related entitie",
Name = "Employee Entity"
});
});
modelBuilder.Entity("Marco.Pms.Model.Master.ExpensesStatusMaster", b =>
{
b.Property<Guid>("Id")
@ -2236,6 +2742,14 @@ namespace Marco.Pms.DataAccess.Migrations
Name = "Attendance Management"
},
new
{
Id = new Guid("a8cf4331-8f04-4961-8360-a3f7c3cc7462"),
Description = "Manage Document",
IsActive = true,
ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"),
Name = "Document Management"
},
new
{
Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"),
Description = "Global Masters",
@ -4007,6 +4521,60 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("Employee");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.AttachmentTagMapping", b =>
{
b.HasOne("Marco.Pms.Model.DocumentManager.DocumentAttachment", "Attachment")
.WithMany()
.HasForeignKey("AttachmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.DocumentManager.DocumentTagMaster", "DocumentTag")
.WithMany()
.HasForeignKey("DocumentTagId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Attachment");
b.Navigation("DocumentTag");
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.AttachmentVersionMapping", b =>
{
b.HasOne("Marco.Pms.Model.DocumentManager.DocumentAttachment", "ChildAttachment")
.WithMany()
.HasForeignKey("ChildAttachmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.DocumentManager.DocumentAttachment", "ParentAttachment")
.WithMany()
.HasForeignKey("ParentAttachmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ChildAttachment");
b.Navigation("ParentAttachment");
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.Document", b =>
{
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
@ -4024,6 +4592,121 @@ namespace Marco.Pms.DataAccess.Migrations
b.Navigation("UploadedBy");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentAttachment", b =>
{
b.HasOne("Marco.Pms.Model.DocumentManager.DocumentTypeMaster", "DocumentType")
.WithMany()
.HasForeignKey("DocumentTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedBy")
.WithMany()
.HasForeignKey("UpdatedById");
b.HasOne("Marco.Pms.Model.Employees.Employee", "UploadedBy")
.WithMany()
.HasForeignKey("UploadedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.Employees.Employee", "VerifiedBy")
.WithMany()
.HasForeignKey("VerifiedById");
b.Navigation("DocumentType");
b.Navigation("Tenant");
b.Navigation("UpdatedBy");
b.Navigation("UploadedBy");
b.Navigation("VerifiedBy");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentAttachmentMapping", b =>
{
b.HasOne("Marco.Pms.Model.DocumentManager.DocumentAttachment", "Attachment")
.WithMany()
.HasForeignKey("AttachmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.DocumentManager.Document", "Document")
.WithMany()
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Attachment");
b.Navigation("Document");
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentCategoryMaster", b =>
{
b.HasOne("Marco.Pms.Model.Master.EntityTypeMaster", "EntityTypeMaster")
.WithMany()
.HasForeignKey("EntityTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EntityTypeMaster");
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentTagMaster", b =>
{
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.DocumentManager.DocumentTypeMaster", b =>
{
b.HasOne("Marco.Pms.Model.DocumentManager.DocumentCategoryMaster", "DocumentCategory")
.WithMany()
.HasForeignKey("DocumentCategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Marco.Pms.Model.TenantModels.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DocumentCategory");
b.Navigation("Tenant");
});
modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b =>
{
b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser")

View File

@ -0,0 +1,22 @@
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.DocumentManager
{
public class AttachmentTagMapping : TenantRelation
{
public Guid Id { get; set; }
public Guid DocumentTagId { get; set; }
[ValidateNever]
[ForeignKey("DocumentTagId")]
public DocumentTagMaster? DocumentTag { get; set; }
public Guid AttachmentId { get; set; }
[ValidateNever]
[ForeignKey("AttachmentId")]
public DocumentAttachment? Attachment { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.DocumentManager
{
public class AttachmentVersionMapping : TenantRelation
{
public Guid Id { get; set; }
public Guid ParentAttachmentId { get; set; }
[ValidateNever]
[ForeignKey("ParentAttachmentId")]
public DocumentAttachment? ParentAttachment { get; set; }
public int Version { get; set; } = 1;
public Guid ChildAttachmentId { get; set; }
[ValidateNever]
[ForeignKey("ChildAttachmentId")]
public DocumentAttachment? ChildAttachment { get; set; }
}
}

View File

@ -0,0 +1,41 @@
using Marco.Pms.Model.Employees;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.DocumentManager
{
public class DocumentAttachment : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? DocumentId { get; set; }
public string Description { get; set; } = string.Empty;
public DateTime UploadedAt { get; set; }
public Guid UploadedById { get; set; } // References the employee who uploaded the document
[ValidateNever]
[ForeignKey("UploadedById")]
public Employee? UploadedBy { get; set; }
public DateTime UpdatedAt { get; set; }
public Guid? UpdatedById { get; set; } // References the employee who updates the document
[ValidateNever]
[ForeignKey("UpdatedById")]
public Employee? UpdatedBy { get; set; }
public DateTime VerifiedAt { get; set; }
public bool? IsVerified { get; set; }
public Guid? VerifiedById { get; set; } // Associates the document with a specific employee, if applicable
[ValidateNever]
[ForeignKey("VerifiedById")]
public Employee? VerifiedBy { get; set; }
public Guid EntityId { get; set; } // Associates the document with a specific project, if applicable
public Guid DocumentTypeId { get; set; }
[ValidateNever]
[ForeignKey("DocumentTypeId")]
public DocumentTypeMaster? DocumentType { get; set; }
public bool IsActive { get; set; } = true;
}
}

View File

@ -0,0 +1,21 @@
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.DocumentManager
{
public class DocumentAttachmentMapping : TenantRelation
{
public Guid Id { get; set; }
public Guid DocumentId { get; set; }
[ValidateNever]
[ForeignKey("DocumentId")]
public Document? Document { get; set; }
public Guid AttachmentId { get; set; }
[ValidateNever]
[ForeignKey("AttachmentId")]
public DocumentAttachment? Attachment { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using Marco.Pms.Model.Master;
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.DocumentManager
{
public class DocumentCategoryMaster : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public Guid EntityTypeId { get; set; }
[ValidateNever]
[ForeignKey("EntityTypeId")]
public EntityTypeMaster? EntityTypeMaster { get; set; }
public DateTime CreatedAt { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using Marco.Pms.Model.Utilities;
namespace Marco.Pms.Model.DocumentManager
{
public class DocumentTagMaster : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,26 @@
using Marco.Pms.Model.Utilities;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Marco.Pms.Model.DocumentManager
{
public class DocumentTypeMaster : TenantRelation
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? RegexExpression { get; set; }
public string AllowedContentType { get; set; } = string.Empty;
public double MaxSizeAllowedInMB { get; set; } = 2;
public bool IsValidationRequired { get; set; } = true;
public bool IsMandatory { get; set; } = true;
public bool IsSystem { get; set; } = false;
public bool IsActive { get; set; } = true;
public Guid DocumentCategoryId { get; set; }
[ValidateNever]
[ForeignKey("DocumentCategoryId")]
public DocumentCategoryMaster? DocumentCategory { get; set; }
public DateTime CreatedAt { get; set; }
}
}