commit 17d42f2cdf550588ad5d71db0a0f9e1514b5a61f Author: Vikas Nale Date: Tue Mar 25 11:53:37 2025 +0530 Add main version branch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9491a2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,363 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd \ No newline at end of file diff --git a/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs new file mode 100644 index 0000000..4cd2dc6 --- /dev/null +++ b/Marco.Pms.DataAccess/Data/ApplicationDbContext.cs @@ -0,0 +1,369 @@ +using Marco.Pms.Model.Activities; +using Marco.Pms.Model.AttendanceModule; +using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using MarcoBMS.Utility; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + +namespace Marco.Pms.DataAccess.Data +{ + public class ApplicationDbContext : IdentityDbContext + { + private readonly IHttpContextAccessor _httpContextAccessor; + + public ApplicationDbContext(DbContextOptions options, IHttpContextAccessor httpContextAccessor) : base(options) + { + _httpContextAccessor = httpContextAccessor; + + } + + public DbSet RefreshTokens { get; set; } + + public DbSet Tenants { get; set; } + public DbSet ApplicationUsers { get; set; } + + public DbSet ActivityMasters { get; set; } + public DbSet Projects { get; set; } + public DbSet ProjectAllocations { get; set; } + + public DbSet StatusMasters { get; set; } + + public DbSet Buildings { get; set; } + public DbSet Floor { get; set; } + + public DbSet WorkAreas { get; set; } + public DbSet WorkItems { get; set; } + public DbSet WorkItemMapping { get; set; } + + public DbSet WorkShifts { get; set; } + + public DbSet TaskAllocations { get; set; } + // public DbSet Attendances { get; set; } + public DbSet Attendes { get; set; } + + public DbSet AttendanceLogs { get; set; } + // public DbSet AttendLogs { get; set; } + + + + public DbSet Employees { get; set; } + public DbSet EmployeeRoleMappings { get; set; } + + public DbSet Modules { get; set; } + public DbSet Features { get; set; } + public DbSet FeaturePermissions { get; set; } + + public DbSet ApplicationRoles { get; set; } + public DbSet JobRoles { get; set; } + public DbSet RolePermissionMappings { get; set; } + + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + ManageApplicationStructure(modelBuilder); + + modelBuilder.Entity().HasData( + new ApplicationRole + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Role = "Admin", + Description = "", + TenantId = 1 + }, + new ApplicationRole + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Role = "Welder", + Description = "", + + TenantId = 1 + }, + new ApplicationRole + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Role = "Helper", + Description = "", + + TenantId = 1 + }, + new ApplicationRole + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Role = "Site Engineer", + Description = "", + + TenantId = 1 + } + , + new ApplicationRole + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Role = "Project Manager", + Description = "", + + TenantId = 1 + } + ); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.HasOne(e => e.User) + .WithMany() + .HasForeignKey(e => e.UserId) + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity().HasData( + new Tenant { Id = 1, Name = "MarcoBMS", ContactName = "Admin", ContactNumber = "123456789", Description = "", DomainName = "www.marcobms.org", OnBoardingDate = DateTime.MinValue } + ); + + modelBuilder.Entity().HasData( + new StatusMaster + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new StatusMaster + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new StatusMaster + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new StatusMaster + { + Id = 4, + Status = "Completed", + TenantId = 1 + } + ); + modelBuilder.Entity().HasData( + new Project + { + Id = 1, + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ContactPerson = "Project 1 Contact Person", + ProjectStatusId = 1, + TenantId = 1 + }, new Project + { + Id = 2, + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ContactPerson = "Project 2 Contact Person", + ProjectStatusId = 2, + TenantId = 1 + }, new Project + { + Id = 3, + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ContactPerson = "Project 3 Contact Person", + ProjectStatusId = 3, + TenantId = 1 + }); + + + var tenantId = _httpContextAccessor.HttpContext?.Items["TenantId"]?.ToString(); + + modelBuilder.Entity() + .HasData( + new ActivityMaster + { + Id = 1, + ActivityName = "Core Cutting", + UnitOfMeasurement = UnitOfMeasurement.Number.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 2, + ActivityName = "Fabrication", + UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 3, + ActivityName = "Lifting", + UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 4, + ActivityName = "Hanging", + UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 5, + ActivityName = "Tapping", + UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 6, + ActivityName = "Welding", + UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 7, + ActivityName = "Testing", + UnitOfMeasurement = UnitOfMeasurement.Area.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 8, + ActivityName = "Painting", + UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 9, + ActivityName = "Marking Area", + UnitOfMeasurement = UnitOfMeasurement.Meter.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 10, + ActivityName = "Drilling", + UnitOfMeasurement = UnitOfMeasurement.Number.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 11, + ActivityName = "MS Support Fabrication", + UnitOfMeasurement = UnitOfMeasurement.Number.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 12, + ActivityName = "MS Support Hanging", + UnitOfMeasurement = UnitOfMeasurement.Number.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 13, + ActivityName = "Hydrant Volve", + UnitOfMeasurement = UnitOfMeasurement.Number.ToString(), + TenantId = 1 + }, new ActivityMaster + { + Id = 14, + ActivityName = "Sprinkler Installation", + UnitOfMeasurement = UnitOfMeasurement.Number.ToString(), + TenantId = 1 + } + ); + } + + private static void ManageApplicationStructure(ModelBuilder modelBuilder) + { + // Configure ApplicationRole to Tenant relationship (if Tenant exists) + modelBuilder.Entity() + .HasOne() // No navigation property in ApplicationRole + .WithMany() + .HasForeignKey(ar => ar.TenantId); + // Configure the relationship between ApplicationRole and FeaturePermission via a join table + modelBuilder.Entity(entity => + { + entity.HasKey(rfp => new { rfp.ApplicationRoleId, rfp.FeaturePermissionId }); + + entity.HasOne() + .WithMany() + .HasForeignKey(rfp => rfp.ApplicationRoleId); + + entity.HasOne() + .WithMany() + .HasForeignKey(rfp => rfp.FeaturePermissionId); + }); + + + + + modelBuilder.Entity().HasData(new Module + { + Id = 1, + Name = "Project", + Description = "Project Module", + Key = Guid.NewGuid().ToString() + }, new Module + { + Id = 2, + Name = "Employee", + Description = "Employee Module", + Key = Guid.NewGuid().ToString() + }, new Module + { + Id = 3, + Name = "Masters", + Description = "Masters Module", + Key = Guid.NewGuid().ToString() + }); + + + + modelBuilder.Entity().HasData( + new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = 1, IsActive = true }, + new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = 1, IsActive = true }, + + new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Manage Tasks", ModuleId = 1, IsActive = true }, + + new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Assign and Update Tasks Progress", Name = "Assign and Update Tasks Progress", ModuleId = 1, IsActive = true }, + + + new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Manage Employee", ModuleId = 2, IsActive = true }, + new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = 2, IsActive = true }, + + new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = 3, IsActive = true }, + new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = 3, IsActive = true } + ); + + modelBuilder.Entity().HasData( + new FeaturePermission { Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "View Project" , Description=""}, + new FeaturePermission { Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "Manage Project", Description = "" }, + new FeaturePermission { Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), IsEnabled = true, Name = "Manage Team", Description = "" }, + + new FeaturePermission { Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), IsEnabled = true, Name = "View Project Infra", Description = "" }, + new FeaturePermission { Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), IsEnabled = true, Name = "Manage Project Infra", Description = "" }, + + + new FeaturePermission { Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "View Task", Description = "" }, + new FeaturePermission { Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "Manage Task", Description = "" }, + + + new FeaturePermission { Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Assign Task and Report Progress", Description = "" }, + new FeaturePermission { Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Approve Task", Description = "" }, + + + new FeaturePermission { Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View Employee", Description = "" }, + new FeaturePermission { Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Manage Employee", Description = "" }, + new FeaturePermission { Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Assign To Project", Description = "" }, + + + new FeaturePermission { Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Perform Attendance ", Description = "" }, + new FeaturePermission { Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Regularize Attendance", Description = "" }, + + new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "" }, + new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "" }, + new FeaturePermission { Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), IsEnabled = true, Name = "View Masters", Description = "" }, + new FeaturePermission { Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), IsEnabled = true, Name = "Manage Masters", Description = "" } + + ); + } + } +} diff --git a/Marco.Pms.DataAccess/Data/docker setup.txt b/Marco.Pms.DataAccess/Data/docker setup.txt new file mode 100644 index 0000000..c6b42b1 --- /dev/null +++ b/Marco.Pms.DataAccess/Data/docker setup.txt @@ -0,0 +1,27 @@ +$ docker pull mysql:latest + +$ docker run --hostname=8b98a48ce3a0 + --mac-address=02:42:ac:11:00:02 + --env=MYSQL_ROOT_PASSWORD=root + --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + --env=GOSU_VERSION=1.17 + --env=MYSQL_MAJOR=innovation + --env=MYSQL_VERSION=9.0.1-1.el9 + --env=MYSQL_SHELL_VERSION=9.0.1-1.el9 + --volume=/var/lib/mysql + --workdir=/ + -p 3333:3306 + --restart=no + --runtime=runc + -d mysql:latest + + +To access the terminal inside your container, you can use the following command: + +$ docker exec -it mysql-db bash + +connect to mysql +> mysql -u root -p +> create database MarcoBMS; + + diff --git a/Marco.Pms.DataAccess/Initializer/DBInitializer.cs b/Marco.Pms.DataAccess/Initializer/DBInitializer.cs new file mode 100644 index 0000000..b3662dc --- /dev/null +++ b/Marco.Pms.DataAccess/Initializer/DBInitializer.cs @@ -0,0 +1,131 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Activities; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.ViewModels; +using MarcoBMS.Utility; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using System.Text.Json; + +namespace Marco.Pms.DataAccess.Initializer +{ + public class DBInitializer : IDBInitializer + { + + private readonly ApplicationDbContext _db; + private readonly UserManager _userManager; + private readonly RoleManager _roleManager; + private readonly IUnitOfWork _unitOfWork; + + public DBInitializer(UserManager userManager, RoleManager roleManager, ApplicationDbContext db, IUnitOfWork unitOfWork) + { + _userManager = userManager; + _roleManager = roleManager; + _db = db; + _unitOfWork = unitOfWork; + + } + public void Initialize() + { + // Migration those are not applied + try + { + if (_db.Database.GetPendingMigrations().Count() > 0) + { + _db.Database.Migrate(); + } + } + catch (Exception ex) { } + + // Create roes if not created + + CreateProjectInfra(); + + if (!_roleManager.RoleExistsAsync(APP_ROLES.Admin.ToString()).GetAwaiter().GetResult()) + { + _roleManager.CreateAsync(new IdentityRole(APP_ROLES.Admin.ToString())).GetAwaiter().GetResult(); + _roleManager.CreateAsync(new IdentityRole(APP_ROLES.Management.ToString())).GetAwaiter().GetResult(); + _roleManager.CreateAsync(new IdentityRole(APP_ROLES.SiteEngineer.ToString())).GetAwaiter().GetResult(); + _roleManager.CreateAsync(new IdentityRole(APP_ROLES.SkilledWorker.ToString())).GetAwaiter().GetResult(); + _roleManager.CreateAsync(new IdentityRole(APP_ROLES.UnskilledWorker.ToString())).GetAwaiter().GetResult(); + + + // Create admin user if roles are not created + _userManager.CreateAsync(new ApplicationUser + { + UserName = "admin@marcobms.com", + Email = "admin@marcobms.com", + PhoneNumber = "1234567890", + // Street = "Street 1", + // State = "State", + // Postalcode = "1234567890", + // City = "City", + TenantId = 1, + IsRootUser = true, + + }, "User@123").GetAwaiter().GetResult(); + + ApplicationUser user = _db.ApplicationUsers.FirstOrDefault(u => u.Email == "admin@marcobms.com"); + _userManager.AddToRoleAsync(user, APP_ROLES.Admin.ToString()).GetAwaiter().GetResult(); + + Employee emp = new Employee() + { + FirstName = "Administrator", + LastName = "", + MiddleName = "", + Gender = "", + EmergencyPhoneNumber = "1234567890", + CurrentAddress = "", + AadharNumber = "1234567890", + ApplicationUserId = user.Id, + BirthDate = DateTime.MinValue, + PanNumber = "", + PeramnentAddress = "", + PhoneNumber = "", + TenantId = user.TenantId + }; + _db.Employees.Add(emp); + + _db.SaveChanges(); + + } + } + + private static void CreateProjectInfra() + { + var jsonData = File.ReadAllText("wwwroot/assets/data/buildings.json"); + + var entities1 = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonData); + + //foreach (Building item in entities1.buildings) + //{ + // _unitOfWork.Building.Add(item); + //} + //_unitOfWork.Save(); + + + //foreach (Floor item in entities1.floors) + //{ + // _unitOfWork.Floor.Add(item); + //} + //_unitOfWork.Save(); + + //foreach (WorkArea item in entities1.workAreas) + //{ + // _unitOfWork.WorkArea.Add(item); + //} + //_unitOfWork.Save(); + + //foreach (WorkItem item in entities1.workItems) + //{ + // _unitOfWork.WorkItem.Add(item); + //} + //_unitOfWork.Save(); + } + } + +} diff --git a/Marco.Pms.DataAccess/Initializer/IDBInitializer.cs b/Marco.Pms.DataAccess/Initializer/IDBInitializer.cs new file mode 100644 index 0000000..38c75ef --- /dev/null +++ b/Marco.Pms.DataAccess/Initializer/IDBInitializer.cs @@ -0,0 +1,7 @@ +namespace Marco.Pms.DataAccess.Initializer +{ + public interface IDBInitializer + { + void Initialize(); + } +} diff --git a/Marco.Pms.DataAccess/Marco.Pms.DataAccess.csproj b/Marco.Pms.DataAccess/Marco.Pms.DataAccess.csproj new file mode 100644 index 0000000..cb22f94 --- /dev/null +++ b/Marco.Pms.DataAccess/Marco.Pms.DataAccess.csproj @@ -0,0 +1,55 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.Designer.cs new file mode 100644 index 0000000..cb83819 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.Designer.cs @@ -0,0 +1,1541 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250124111814_initiateapp")] + partial class initiateapp + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("FeaturePermission"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", "EmployeeRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("EmployeeRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany() + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", "Role") + .WithMany("FeaturePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.cs b/Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.cs new file mode 100644 index 0000000..9b73bf4 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250124111814_initiateapp.cs @@ -0,0 +1,1210 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class initiateapp : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterDatabase() + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + NormalizedName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Discriminator = table.Column(type: "varchar(21)", maxLength: 21, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Role = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: true), + IsRootUser = table.Column(type: "tinyint(1)", nullable: true), + UserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + NormalizedUserName = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Email = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + NormalizedEmail = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + EmailConfirmed = table.Column(type: "tinyint(1)", nullable: false), + PasswordHash = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + SecurityStamp = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ConcurrencyStamp = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumberConfirmed = table.Column(type: "tinyint(1)", nullable: false), + TwoFactorEnabled = table.Column(type: "tinyint(1)", nullable: false), + LockoutEnd = table.Column(type: "datetime(6)", nullable: true), + LockoutEnabled = table.Column(type: "tinyint(1)", nullable: false), + AccessFailedCount = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Tenants", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + DomainName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + OnBoardingDate = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tenants", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RoleId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimType = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimValue = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimType = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ClaimValue = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProviderKey = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProviderDisplayName = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + RoleId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LoginProvider = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Name = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Value = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RefreshTokens", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Token = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + UserId = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ExpiryDate = table.Column(type: "datetime(6)", nullable: false), + IsRevoked = table.Column(type: "tinyint(1)", nullable: false), + IsUsed = table.Column(type: "tinyint(1)", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + RevokedAt = table.Column(type: "datetime(6)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_RefreshTokens", x => x.Id); + table.ForeignKey( + name: "FK_RefreshTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Buildings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + ProjectId = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Buildings", x => x.Id); + table.ForeignKey( + name: "FK_Buildings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "EmployeeRoles", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Role = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeRoles", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeRoles_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Feature", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Feature", x => x.Id); + table.ForeignKey( + name: "FK_Feature_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "StatusMasters", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Status = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StatusMasters", x => x.Id); + table.ForeignKey( + name: "FK_StatusMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "WorkShifts", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + StartTime = table.Column(type: "time(6)", nullable: false), + EndTime = table.Column(type: "time(6)", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkShifts", x => x.Id); + table.ForeignKey( + name: "FK_WorkShifts_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Floor", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + FloorName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + BuildingId = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Floor", x => x.Id); + table.ForeignKey( + name: "FK_Floor_Buildings_BuildingId", + column: x => x.BuildingId, + principalTable: "Buildings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Floor_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Employees", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + FirstName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + LastName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + MiddleName = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Email = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Gender = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + BirthDate = table.Column(type: "datetime(6)", nullable: true), + PeramnentAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CurrentAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PhoneNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmergencyPhoneNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + AadharNumber = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + PanNumber = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Photo = table.Column(type: "longblob", nullable: true), + ApplicationUserId = table.Column(type: "varchar(255)", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false), + RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_Employees", x => x.Id); + table.ForeignKey( + name: "FK_Employees_AspNetUsers_ApplicationUserId", + column: x => x.ApplicationUserId, + principalTable: "AspNetUsers", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Employees_EmployeeRoles_RoleId", + column: x => x.RoleId, + principalTable: "EmployeeRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Employees_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "FeaturePermission", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + FeatureId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsEnabled = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FeaturePermission", x => x.Id); + table.ForeignKey( + name: "FK_FeaturePermission_EmployeeRoles_RoleId", + column: x => x.RoleId, + principalTable: "EmployeeRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FeaturePermission_Feature_FeatureId", + column: x => x.FeatureId, + principalTable: "Feature", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FeaturePermission_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Projects", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ProjectAddress = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ContactPerson = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + StartDate = table.Column(type: "datetime(6)", nullable: true), + EndDate = table.Column(type: "datetime(6)", nullable: true), + ProjectStatusId = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Projects", x => x.Id); + table.ForeignKey( + name: "FK_Projects_StatusMasters_ProjectStatusId", + column: x => x.ProjectStatusId, + principalTable: "StatusMasters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Projects_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "WorkAreas", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AreaName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + FloorId = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkAreas", x => x.Id); + table.ForeignKey( + name: "FK_WorkAreas_Floor_FloorId", + column: x => x.FloorId, + principalTable: "Floor", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WorkAreas_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "AttendanceLogs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmployeeID = table.Column(type: "int", nullable: false), + CheckTime = table.Column(type: "datetime(6)", nullable: true), + IsCheckIn = table.Column(type: "tinyint(1)", nullable: false), + Photo = table.Column(type: "longblob", nullable: true), + Latitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Longitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false), + UpdatedBy = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_AttendanceLogs", x => x.Id); + table.ForeignKey( + name: "FK_AttendanceLogs_Employees_EmployeeID", + column: x => x.EmployeeID, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendanceLogs_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ProjectAllocations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeId = table.Column(type: "int", nullable: false), + EmployeeRoleId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + ProjectId = table.Column(type: "int", nullable: false), + AllocationDate = table.Column(type: "datetime(6)", nullable: false), + ReAllocationDate = table.Column(type: "datetime(6)", nullable: true), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProjectAllocations", x => x.Id); + table.ForeignKey( + name: "FK_ProjectAllocations_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProjectAllocations_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProjectAllocations_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "TaskAllocations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + EmployeeId = table.Column(type: "int", nullable: false), + EmployeeRole = table.Column(type: "int", nullable: false), + ProjectId = table.Column(type: "int", nullable: false), + BuildingId = table.Column(type: "int", nullable: false), + AllocationDate = table.Column(type: "datetime(6)", nullable: false), + ReAllocationDate = table.Column(type: "datetime(6)", nullable: false), + WorkAreaId = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TaskAllocations", x => x.Id); + table.ForeignKey( + name: "FK_TaskAllocations_Buildings_BuildingId", + column: x => x.BuildingId, + principalTable: "Buildings", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskAllocations_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskAllocations_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskAllocations_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TaskAllocations_WorkAreas_WorkAreaId", + column: x => x.WorkAreaId, + principalTable: "WorkAreas", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Attendances", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmployeeID = table.Column(type: "int", nullable: false), + Date = table.Column(type: "datetime(6)", nullable: false), + InTimeID = table.Column(type: "int", nullable: true), + OutTimeID = table.Column(type: "int", nullable: true), + IsApproved = table.Column(type: "tinyint(1)", nullable: false), + ApprovedBy = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Attendances", x => x.Id); + table.ForeignKey( + name: "FK_Attendances_AttendanceLogs_InTimeID", + column: x => x.InTimeID, + principalTable: "AttendanceLogs", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Attendances_AttendanceLogs_OutTimeID", + column: x => x.OutTimeID, + principalTable: "AttendanceLogs", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Attendances_Employees_EmployeeID", + column: x => x.EmployeeID, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Attendances_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ActivityMasters", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ActivityName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + UnitOfMeasurement = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false), + TaskAllocationId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ActivityMasters", x => x.Id); + table.ForeignKey( + name: "FK_ActivityMasters_TaskAllocations_TaskAllocationId", + column: x => x.TaskAllocationId, + principalTable: "TaskAllocations", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ActivityMasters_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "WorkItems", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ActivityId = table.Column(type: "int", nullable: false), + WorkAreaId = table.Column(type: "int", nullable: false), + PlannedWork = table.Column(type: "int", nullable: false), + CompletedWork = table.Column(type: "int", nullable: false), + TaskDate = table.Column(type: "datetime(6)", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkItems", x => x.Id); + table.ForeignKey( + name: "FK_WorkItems_ActivityMasters_ActivityId", + column: x => x.ActivityId, + principalTable: "ActivityMasters", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WorkItems_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WorkItems_WorkAreas_WorkAreaId", + column: x => x.WorkAreaId, + principalTable: "WorkAreas", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "WorkItemMapping", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + WorkAreaId = table.Column(type: "int", nullable: false), + WorkItemId = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WorkItemMapping", x => x.Id); + table.ForeignKey( + name: "FK_WorkItemMapping_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WorkItemMapping_WorkAreas_WorkAreaId", + column: x => x.WorkAreaId, + principalTable: "WorkAreas", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WorkItemMapping_WorkItems_WorkItemId", + column: x => x.WorkItemId, + principalTable: "WorkItems", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.InsertData( + table: "Tenants", + columns: new[] { "Id", "ContactName", "ContactNumber", "Description", "DomainName", "Name", "OnBoardingDate" }, + values: new object[] { 1, "Admin", "123456789", "", "www.marcobms.org", "MarcoBMS", new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) }); + + migrationBuilder.InsertData( + table: "ActivityMasters", + columns: new[] { "Id", "ActivityName", "TaskAllocationId", "TenantId", "UnitOfMeasurement" }, + values: new object[,] + { + { 1, "Core Cutting", null, 1, "Number" }, + { 2, "Fabrication", null, 1, "Meter" }, + { 3, "Lifting", null, 1, "Meter" }, + { 4, "Hanging", null, 1, "Meter" }, + { 5, "Tapping", null, 1, "Meter" }, + { 6, "Welding", null, 1, "Meter" }, + { 7, "Testing", null, 1, "Area" }, + { 8, "Painting", null, 1, "Meter" }, + { 9, "Marking Area", null, 1, "Meter" }, + { 10, "Drilling", null, 1, "Number" }, + { 11, "MS Support Fabrication", null, 1, "Number" }, + { 12, "MS Support Hanging", null, 1, "Number" }, + { 13, "Hydrant Volve", null, 1, "Number" }, + { 14, "Sprinkler Installation", null, 1, "Number" } + }); + + migrationBuilder.InsertData( + table: "EmployeeRoles", + columns: new[] { "Id", "Role", "TenantId" }, + values: new object[,] + { + { new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), "Admin", 1 }, + { new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), "Welder", 1 }, + { new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), "Helper", 1 }, + { new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), "Site Engineer", 1 }, + { new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), "Project Manager", 1 } + }); + + migrationBuilder.InsertData( + table: "StatusMasters", + columns: new[] { "Id", "Status", "TenantId" }, + values: new object[,] + { + { 1, "Active", 1 }, + { 2, "In Progress", 1 }, + { 3, "On Hold", 1 }, + { 4, "Completed", 1 } + }); + + migrationBuilder.InsertData( + table: "Projects", + columns: new[] { "Id", "ContactPerson", "EndDate", "Name", "ProjectAddress", "ProjectStatusId", "StartDate", "TenantId" }, + values: new object[,] + { + { 1, "Project 1 Contact Person", null, "Project 1", "Project 1 Address", 1, null, 1 }, + { 2, "Project 2 Contact Person", null, "Project 2", "Project 2 Address", 2, null, 1 }, + { 3, "Project 3 Contact Person", null, "Project 3", "Project 3 Address", 3, null, 1 } + }); + + migrationBuilder.CreateIndex( + name: "IX_ActivityMasters_TaskAllocationId", + table: "ActivityMasters", + column: "TaskAllocationId"); + + migrationBuilder.CreateIndex( + name: "IX_ActivityMasters_TenantId", + table: "ActivityMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_EmployeeID", + table: "AttendanceLogs", + column: "EmployeeID"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_TenantId", + table: "AttendanceLogs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Attendances_EmployeeID", + table: "Attendances", + column: "EmployeeID"); + + migrationBuilder.CreateIndex( + name: "IX_Attendances_InTimeID", + table: "Attendances", + column: "InTimeID"); + + migrationBuilder.CreateIndex( + name: "IX_Attendances_OutTimeID", + table: "Attendances", + column: "OutTimeID"); + + migrationBuilder.CreateIndex( + name: "IX_Attendances_TenantId", + table: "Attendances", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Buildings_TenantId", + table: "Buildings", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeRoles_TenantId", + table: "EmployeeRoles", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Employees_ApplicationUserId", + table: "Employees", + column: "ApplicationUserId"); + + migrationBuilder.CreateIndex( + name: "IX_Employees_RoleId", + table: "Employees", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_Employees_TenantId", + table: "Employees", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Feature_TenantId", + table: "Feature", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_FeaturePermission_FeatureId", + table: "FeaturePermission", + column: "FeatureId"); + + migrationBuilder.CreateIndex( + name: "IX_FeaturePermission_RoleId", + table: "FeaturePermission", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_FeaturePermission_TenantId", + table: "FeaturePermission", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Floor_BuildingId", + table: "Floor", + column: "BuildingId"); + + migrationBuilder.CreateIndex( + name: "IX_Floor_TenantId", + table: "Floor", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_ProjectAllocations_EmployeeId", + table: "ProjectAllocations", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_ProjectAllocations_ProjectId", + table: "ProjectAllocations", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ProjectAllocations_TenantId", + table: "ProjectAllocations", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Projects_ProjectStatusId", + table: "Projects", + column: "ProjectStatusId"); + + migrationBuilder.CreateIndex( + name: "IX_Projects_TenantId", + table: "Projects", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_RefreshTokens_UserId", + table: "RefreshTokens", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_StatusMasters_TenantId", + table: "StatusMasters", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_BuildingId", + table: "TaskAllocations", + column: "BuildingId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_EmployeeId", + table: "TaskAllocations", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_ProjectId", + table: "TaskAllocations", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_TenantId", + table: "TaskAllocations", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_TaskAllocations_WorkAreaId", + table: "TaskAllocations", + column: "WorkAreaId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkAreas_FloorId", + table: "WorkAreas", + column: "FloorId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkAreas_TenantId", + table: "WorkAreas", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkItemMapping_TenantId", + table: "WorkItemMapping", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkItemMapping_WorkAreaId", + table: "WorkItemMapping", + column: "WorkAreaId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkItemMapping_WorkItemId", + table: "WorkItemMapping", + column: "WorkItemId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkItems_ActivityId", + table: "WorkItems", + column: "ActivityId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkItems_TenantId", + table: "WorkItems", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkItems_WorkAreaId", + table: "WorkItems", + column: "WorkAreaId"); + + migrationBuilder.CreateIndex( + name: "IX_WorkShifts_TenantId", + table: "WorkShifts", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens"); + + migrationBuilder.DropTable( + name: "Attendances"); + + migrationBuilder.DropTable( + name: "FeaturePermission"); + + migrationBuilder.DropTable( + name: "ProjectAllocations"); + + migrationBuilder.DropTable( + name: "RefreshTokens"); + + migrationBuilder.DropTable( + name: "WorkItemMapping"); + + migrationBuilder.DropTable( + name: "WorkShifts"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "AttendanceLogs"); + + migrationBuilder.DropTable( + name: "Feature"); + + migrationBuilder.DropTable( + name: "WorkItems"); + + migrationBuilder.DropTable( + name: "ActivityMasters"); + + migrationBuilder.DropTable( + name: "TaskAllocations"); + + migrationBuilder.DropTable( + name: "Employees"); + + migrationBuilder.DropTable( + name: "Projects"); + + migrationBuilder.DropTable( + name: "WorkAreas"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "EmployeeRoles"); + + migrationBuilder.DropTable( + name: "StatusMasters"); + + migrationBuilder.DropTable( + name: "Floor"); + + migrationBuilder.DropTable( + name: "Buildings"); + + migrationBuilder.DropTable( + name: "Tenants"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250204133319_role.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250204133319_role.Designer.cs new file mode 100644 index 0000000..2ad16ca --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250204133319_role.Designer.cs @@ -0,0 +1,1553 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250204133319_role")] + partial class role + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Features"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowCreate") + .HasColumnType("tinyint(1)"); + + b.Property("AllowDelete") + .HasColumnType("tinyint(1)"); + + b.Property("AllowModify") + .HasColumnType("tinyint(1)"); + + b.Property("AllowView") + .HasColumnType("tinyint(1)"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermission"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", "EmployeeRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("EmployeeRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", null) + .WithMany("Features") + .HasForeignKey("EmployeeRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Navigation("Features"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250204133319_role.cs b/Marco.Pms.DataAccess/Migrations/20250204133319_role.cs new file mode 100644 index 0000000..3a78f05 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250204133319_role.cs @@ -0,0 +1,278 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class role : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Feature_Tenants_TenantId", + table: "Feature"); + + migrationBuilder.DropForeignKey( + name: "FK_FeaturePermission_EmployeeRoles_RoleId", + table: "FeaturePermission"); + + migrationBuilder.DropForeignKey( + name: "FK_FeaturePermission_Feature_FeatureId", + table: "FeaturePermission"); + + migrationBuilder.DropForeignKey( + name: "FK_FeaturePermission_Tenants_TenantId", + table: "FeaturePermission"); + + migrationBuilder.DropIndex( + name: "IX_FeaturePermission_RoleId", + table: "FeaturePermission"); + + migrationBuilder.DropIndex( + name: "IX_FeaturePermission_TenantId", + table: "FeaturePermission"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Feature", + table: "Feature"); + + migrationBuilder.DropColumn( + name: "RoleId", + table: "FeaturePermission"); + + migrationBuilder.RenameTable( + name: "Feature", + newName: "Features"); + + migrationBuilder.RenameIndex( + name: "IX_Feature_TenantId", + table: "Features", + newName: "IX_Features_TenantId"); + + migrationBuilder.AddColumn( + name: "AllowCreate", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "AllowDelete", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "AllowModify", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "AllowView", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "Description", + table: "EmployeeRoles", + type: "longtext", + nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "EmployeeRoleId", + table: "Features", + type: "char(36)", + nullable: true, + collation: "ascii_general_ci"); + + migrationBuilder.AddPrimaryKey( + name: "PK_Features", + table: "Features", + column: "Id"); + + migrationBuilder.UpdateData( + table: "EmployeeRoles", + keyColumn: "Id", + keyValue: new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + column: "Description", + value: ""); + + migrationBuilder.UpdateData( + table: "EmployeeRoles", + keyColumn: "Id", + keyValue: new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + column: "Description", + value: ""); + + migrationBuilder.UpdateData( + table: "EmployeeRoles", + keyColumn: "Id", + keyValue: new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + column: "Description", + value: ""); + + migrationBuilder.UpdateData( + table: "EmployeeRoles", + keyColumn: "Id", + keyValue: new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + column: "Description", + value: ""); + + migrationBuilder.UpdateData( + table: "EmployeeRoles", + keyColumn: "Id", + keyValue: new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + column: "Description", + value: ""); + + migrationBuilder.CreateIndex( + name: "IX_Features_EmployeeRoleId", + table: "Features", + column: "EmployeeRoleId"); + + migrationBuilder.AddForeignKey( + name: "FK_FeaturePermission_Features_FeatureId", + table: "FeaturePermission", + column: "FeatureId", + principalTable: "Features", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Features_EmployeeRoles_EmployeeRoleId", + table: "Features", + column: "EmployeeRoleId", + principalTable: "EmployeeRoles", + principalColumn: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_Features_Tenants_TenantId", + table: "Features", + column: "TenantId", + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_FeaturePermission_Features_FeatureId", + table: "FeaturePermission"); + + migrationBuilder.DropForeignKey( + name: "FK_Features_EmployeeRoles_EmployeeRoleId", + table: "Features"); + + migrationBuilder.DropForeignKey( + name: "FK_Features_Tenants_TenantId", + table: "Features"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Features", + table: "Features"); + + migrationBuilder.DropIndex( + name: "IX_Features_EmployeeRoleId", + table: "Features"); + + migrationBuilder.DropColumn( + name: "AllowCreate", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "AllowDelete", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "AllowModify", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "AllowView", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "Description", + table: "EmployeeRoles"); + + migrationBuilder.DropColumn( + name: "EmployeeRoleId", + table: "Features"); + + migrationBuilder.RenameTable( + name: "Features", + newName: "Feature"); + + migrationBuilder.RenameIndex( + name: "IX_Features_TenantId", + table: "Feature", + newName: "IX_Feature_TenantId"); + + migrationBuilder.AddColumn( + name: "RoleId", + table: "FeaturePermission", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.AddPrimaryKey( + name: "PK_Feature", + table: "Feature", + column: "Id"); + + migrationBuilder.CreateIndex( + name: "IX_FeaturePermission_RoleId", + table: "FeaturePermission", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_FeaturePermission_TenantId", + table: "FeaturePermission", + column: "TenantId"); + + migrationBuilder.AddForeignKey( + name: "FK_Feature_Tenants_TenantId", + table: "Feature", + column: "TenantId", + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_FeaturePermission_EmployeeRoles_RoleId", + table: "FeaturePermission", + column: "RoleId", + principalTable: "EmployeeRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_FeaturePermission_Feature_FeatureId", + table: "FeaturePermission", + column: "FeatureId", + principalTable: "Feature", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_FeaturePermission_Tenants_TenantId", + table: "FeaturePermission", + column: "TenantId", + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.Designer.cs new file mode 100644 index 0000000..2a69af3 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.Designer.cs @@ -0,0 +1,1807 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250205081523_addFeatures")] + partial class addFeatures + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeRoleId"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "9a7ed07c-f7dd-4831-bf64-d5278fa9e38c", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "a9fb08bf-7dae-4282-9b02-f63d94d7a9dc", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "e6423995-d7bf-452e-8bcc-780a655b015c", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", "EmployeeRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("EmployeeRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", null) + .WithMany("Features") + .HasForeignKey("EmployeeRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", null) + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Navigation("Features"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.cs b/Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.cs new file mode 100644 index 0000000..83fa617 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250205081523_addFeatures.cs @@ -0,0 +1,416 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class addFeatures : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_FeaturePermission_Features_FeatureId", + table: "FeaturePermission"); + + migrationBuilder.DropForeignKey( + name: "FK_Features_Tenants_TenantId", + table: "Features"); + + migrationBuilder.DropPrimaryKey( + name: "PK_FeaturePermission", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "AllowCreate", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "AllowDelete", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "AllowModify", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "AllowView", + table: "FeaturePermission"); + + migrationBuilder.DropColumn( + name: "TenantId", + table: "FeaturePermission"); + + migrationBuilder.RenameTable( + name: "FeaturePermission", + newName: "FeaturePermissions"); + + migrationBuilder.RenameColumn( + name: "TenantId", + table: "Features", + newName: "ModuleId"); + + migrationBuilder.RenameIndex( + name: "IX_Features_TenantId", + table: "Features", + newName: "IX_Features_ModuleId"); + + migrationBuilder.RenameIndex( + name: "IX_FeaturePermission_FeatureId", + table: "FeaturePermissions", + newName: "IX_FeaturePermissions_FeatureId"); + + migrationBuilder.AddColumn( + name: "IsActive", + table: "Features", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "Description", + table: "FeaturePermissions", + type: "longtext", + nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "Name", + table: "FeaturePermissions", + type: "longtext", + nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddPrimaryKey( + name: "PK_FeaturePermissions", + table: "FeaturePermissions", + column: "Id"); + + migrationBuilder.CreateTable( + name: "Modules", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Key = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Modules", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.InsertData( + table: "Modules", + columns: new[] { "Id", "Description", "Key", "Name" }, + values: new object[,] + { + { 1, "Project Module", "9a7ed07c-f7dd-4831-bf64-d5278fa9e38c", "Project" }, + { 2, "Employee Module", "a9fb08bf-7dae-4282-9b02-f63d94d7a9dc", "Employee" }, + { 3, "Masters Module", "e6423995-d7bf-452e-8bcc-780a655b015c", "Masters" } + }); + + migrationBuilder.InsertData( + table: "Features", + columns: new[] { "Id", "Description", "EmployeeRoleId", "IsActive", "ModuleId", "Name" }, + values: new object[,] + { + { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Assign and Update Tasks Progress", null, true, 1, "Assign and Update Tasks Progress" }, + { new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), "Attendance", null, true, 2, "Attendance" }, + { new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), "Manage Project", null, true, 1, "Manage Project" }, + { new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), "Tenant Masters", null, true, 3, "Tenant Masters" }, + { new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), "Manage Employee", null, true, 2, "Manage Employee" }, + { new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), "Manage Infra", null, true, 1, "Manage Infra" }, + { new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), "Manage Tasks", null, true, 1, "Manage Tasks" }, + { new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), "Global Masters", null, true, 3, "Global Masters" } + }); + + migrationBuilder.InsertData( + table: "FeaturePermissions", + columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" }, + values: new object[,] + { + { new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "Manage Task" }, + { new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Project" }, + { new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Regularize Attendance" }, + { new Guid("588a8824-f924-4955-82d8-fc51956cf323"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "Manage Masters" }, + { new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "View Masters" }, + { new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "Manage Masters" }, + { new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "View Project" }, + { new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Perform Attendance " }, + { new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "View Task" }, + { new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Manage Employee" }, + { new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "View Employee" }, + { new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Team" }, + { new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "View Project Infra" }, + { new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "View Masters" }, + { new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Assign Task and Report Progress" }, + { new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Approve Task" }, + { new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "Manage Project Infra" }, + { new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Assign To Project" } + }); + + migrationBuilder.AddForeignKey( + name: "FK_FeaturePermissions_Features_FeatureId", + table: "FeaturePermissions", + column: "FeatureId", + principalTable: "Features", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Features_Modules_ModuleId", + table: "Features", + column: "ModuleId", + principalTable: "Modules", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_FeaturePermissions_Features_FeatureId", + table: "FeaturePermissions"); + + migrationBuilder.DropForeignKey( + name: "FK_Features_Modules_ModuleId", + table: "Features"); + + migrationBuilder.DropTable( + name: "Modules"); + + migrationBuilder.DropPrimaryKey( + name: "PK_FeaturePermissions", + table: "FeaturePermissions"); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("172fc9b6-755b-4f62-ab26-55c34a330614")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("588a8824-f924-4955-82d8-fc51956cf323")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("a97d366a-c2bb-448d-be93-402bd2324566")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("b94802ce-0689-4643-9e1d-11c86950c35b")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("cb8ec407-46d4-4467-930c-69127cda6dec")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("f2aee20a-b754-4537-8166-f9507b44585b")); + + migrationBuilder.DeleteData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("53176ebf-c75d-42e5-839f-4508ffac3def")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("660131a4-788c-4739-a082-cbbf7879cbf2")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f")); + + migrationBuilder.DeleteData( + table: "Features", + keyColumn: "Id", + keyValue: new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be")); + + migrationBuilder.DropColumn( + name: "IsActive", + table: "Features"); + + migrationBuilder.DropColumn( + name: "Description", + table: "FeaturePermissions"); + + migrationBuilder.DropColumn( + name: "Name", + table: "FeaturePermissions"); + + migrationBuilder.RenameTable( + name: "FeaturePermissions", + newName: "FeaturePermission"); + + migrationBuilder.RenameColumn( + name: "ModuleId", + table: "Features", + newName: "TenantId"); + + migrationBuilder.RenameIndex( + name: "IX_Features_ModuleId", + table: "Features", + newName: "IX_Features_TenantId"); + + migrationBuilder.RenameIndex( + name: "IX_FeaturePermissions_FeatureId", + table: "FeaturePermission", + newName: "IX_FeaturePermission_FeatureId"); + + migrationBuilder.AddColumn( + name: "AllowCreate", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "AllowDelete", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "AllowModify", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "AllowView", + table: "FeaturePermission", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "TenantId", + table: "FeaturePermission", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddPrimaryKey( + name: "PK_FeaturePermission", + table: "FeaturePermission", + column: "Id"); + + migrationBuilder.AddForeignKey( + name: "FK_FeaturePermission_Features_FeatureId", + table: "FeaturePermission", + column: "FeatureId", + principalTable: "Features", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Features_Tenants_TenantId", + table: "Features", + column: "TenantId", + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.Designer.cs new file mode 100644 index 0000000..977bcbe --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.Designer.cs @@ -0,0 +1,1809 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250205082324_featuremapping")] + partial class featuremapping + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeRoleId"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "73f5248b-c0d7-49de-a045-3617339c94cd", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "35fd0032-dfb1-44a4-931c-b9417ec406e7", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "adccb225-5824-4b96-96f8-d28143c42475", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", "EmployeeRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("EmployeeRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.EmployeeRole", null) + .WithMany("Features") + .HasForeignKey("EmployeeRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRole", b => + { + b.Navigation("Features"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.cs b/Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.cs new file mode 100644 index 0000000..77b5c96 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250205082324_featuremapping.cs @@ -0,0 +1,60 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class featuremapping : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "73f5248b-c0d7-49de-a045-3617339c94cd"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "35fd0032-dfb1-44a4-931c-b9417ec406e7"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "adccb225-5824-4b96-96f8-d28143c42475"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "9a7ed07c-f7dd-4831-bf64-d5278fa9e38c"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "a9fb08bf-7dae-4282-9b02-f63d94d7a9dc"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "e6423995-d7bf-452e-8bcc-780a655b015c"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.Designer.cs new file mode 100644 index 0000000..97e6337 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.Designer.cs @@ -0,0 +1,1716 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250206083015_NoNavigationMigration")] + partial class NoNavigationMigration + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "b29e3352-d83f-42eb-9c57-6e2cbf1b7c9b", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "d522bcb3-6965-4c2f-be14-dd18b3181a34", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "77302f42-93ec-49eb-9e05-80b80939639a", + Name = "Masters" + }); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.cs b/Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.cs new file mode 100644 index 0000000..496c3d8 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250206083015_NoNavigationMigration.cs @@ -0,0 +1,73 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class NoNavigationMigration : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + //migrationBuilder.AddColumn( + // name: "RoleId", + // table: "Employees", + // type: "char(36)", + // nullable: false, + // defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + // collation: "ascii_general_ci"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "b29e3352-d83f-42eb-9c57-6e2cbf1b7c9b"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "d522bcb3-6965-4c2f-be14-dd18b3181a34"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "77302f42-93ec-49eb-9e05-80b80939639a"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + //migrationBuilder.DropColumn( + // name: "RoleId", + // table: "Employees"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "03f97e79-e7ff-412b-91b4-19b71325f00c"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "2351d591-bdd5-4eb5-a375-125c8cfdcf29"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "bedbed6b-8ea5-4bd2-a37c-d5454d0dd280"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.Designer.cs new file mode 100644 index 0000000..6924c0e --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.Designer.cs @@ -0,0 +1,1717 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250206101247_updatefeaturesmaster")] + partial class updatefeaturesmaster + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "b0aa1d10-7b8a-40f1-96b3-219e8de89ccb", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "19101abd-012e-4809-b153-da6bdbca0d7a", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "0cb9a301-edf2-4a15-8eeb-5bfea0ad4d90", + Name = "Masters" + }); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.cs b/Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.cs new file mode 100644 index 0000000..db49b97 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250206101247_updatefeaturesmaster.cs @@ -0,0 +1,89 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class updatefeaturesmaster : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + column: "FeatureId", + value: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); + + migrationBuilder.UpdateData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + column: "FeatureId", + value: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "b0aa1d10-7b8a-40f1-96b3-219e8de89ccb"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "19101abd-012e-4809-b153-da6bdbca0d7a"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "0cb9a301-edf2-4a15-8eeb-5bfea0ad4d90"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + column: "FeatureId", + value: new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100")); + + migrationBuilder.UpdateData( + table: "FeaturePermissions", + keyColumn: "Id", + keyValue: new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + column: "FeatureId", + value: new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100")); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "b29e3352-d83f-42eb-9c57-6e2cbf1b7c9b"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "d522bcb3-6965-4c2f-be14-dd18b3181a34"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "77302f42-93ec-49eb-9e05-80b80939639a"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250206114122_mapping.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250206114122_mapping.Designer.cs new file mode 100644 index 0000000..b61499a --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250206114122_mapping.Designer.cs @@ -0,0 +1,1706 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250206114122_mapping")] + partial class mapping + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "eec3cf92-01c2-41a2-bfc1-f3c2af318848", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "6a22bf2f-e8f0-4164-aedc-307b370b4ef6", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "69a68bf1-30e7-45fc-ab75-0c11ea10bfc3", + Name = "Masters" + }); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250206114122_mapping.cs b/Marco.Pms.DataAccess/Migrations/20250206114122_mapping.cs new file mode 100644 index 0000000..de18d58 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250206114122_mapping.cs @@ -0,0 +1,65 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class mapping : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "eec3cf92-01c2-41a2-bfc1-f3c2af318848"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "6a22bf2f-e8f0-4164-aedc-307b370b4ef6"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "69a68bf1-30e7-45fc-ab75-0c11ea10bfc3"); + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "b0aa1d10-7b8a-40f1-96b3-219e8de89ccb"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "19101abd-012e-4809-b153-da6bdbca0d7a"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "0cb9a301-edf2-4a15-8eeb-5bfea0ad4d90"); + + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.Designer.cs new file mode 100644 index 0000000..372f280 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.Designer.cs @@ -0,0 +1,1813 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250207070319_RolePermissionMappings")] + partial class RolePermissionMappings + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "286516c2-0d55-439c-a8fa-b6858735ef65", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "6a84b9c0-1478-4d87-9ef6-34c00f0fca4a", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "c38971e1-491e-479f-9d02-54634c0b4908", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.cs b/Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.cs new file mode 100644 index 0000000..723d938 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250207070319_RolePermissionMappings.cs @@ -0,0 +1,139 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class RolePermissionMappings : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ApplicationRoles", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + Role = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ApplicationRoles", x => x.Id); + table.ForeignKey( + name: "FK_ApplicationRoles_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "RolePermissionMappings", + columns: table => new + { + ApplicationRoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + FeaturePermissionId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") + }, + constraints: table => + { + table.PrimaryKey("PK_RolePermissionMappings", x => new { x.ApplicationRoleId, x.FeaturePermissionId }); + table.ForeignKey( + name: "FK_RolePermissionMappings_ApplicationRoles_ApplicationRoleId", + column: x => x.ApplicationRoleId, + principalTable: "ApplicationRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_RolePermissionMappings_FeaturePermissions_FeaturePermissionId", + column: x => x.FeaturePermissionId, + principalTable: "FeaturePermissions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.InsertData( + table: "ApplicationRoles", + columns: new[] { "Id", "Description", "Role", "TenantId" }, + values: new object[,] + { + { new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), "", "Admin", 1 }, + { new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), "", "Welder", 1 }, + { new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), "", "Helper", 1 }, + { new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), "", "Site Engineer", 1 }, + { new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), "", "Project Manager", 1 } + }); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "286516c2-0d55-439c-a8fa-b6858735ef65"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "6a84b9c0-1478-4d87-9ef6-34c00f0fca4a"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "c38971e1-491e-479f-9d02-54634c0b4908"); + + migrationBuilder.CreateIndex( + name: "IX_ApplicationRoles_TenantId", + table: "ApplicationRoles", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_RolePermissionMappings_FeaturePermissionId", + table: "RolePermissionMappings", + column: "FeaturePermissionId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "RolePermissionMappings"); + + migrationBuilder.DropTable( + name: "ApplicationRoles"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "235d7bb6-9fae-4cdc-bc62-2426059cd49e"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "e60119bf-48b1-4534-82ae-88d23ae46f15"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "9090b0dd-7a3c-46f7-82e5-816eb6c416d2"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.Designer.cs new file mode 100644 index 0000000..41892f7 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.Designer.cs @@ -0,0 +1,1869 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250208050500_EmployeeRolesMapping")] + partial class EmployeeRolesMapping + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "05db8d60-e977-40f6-b944-8602d0d4cb98", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "456ddbbe-0963-406d-8874-589a546c3670", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "19eca67f-c3b1-4e5c-8d95-c8341cf058ae", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.cs b/Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.cs new file mode 100644 index 0000000..696ba82 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250208050500_EmployeeRolesMapping.cs @@ -0,0 +1,113 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class EmployeeRolesMapping : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "EmployeeRoleMappings", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + EmployeeId = table.Column(type: "int", nullable: false), + RoleId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IsEnabled = table.Column(type: "tinyint(1)", nullable: false), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeRoleMappings", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeRoleMappings_ApplicationRoles_RoleId", + column: x => x.RoleId, + principalTable: "ApplicationRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EmployeeRoleMappings_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_EmployeeRoleMappings_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "05db8d60-e977-40f6-b944-8602d0d4cb98"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "456ddbbe-0963-406d-8874-589a546c3670"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "19eca67f-c3b1-4e5c-8d95-c8341cf058ae"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeRoleMappings_EmployeeId", + table: "EmployeeRoleMappings", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeRoleMappings_RoleId", + table: "EmployeeRoleMappings", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeRoleMappings_TenantId", + table: "EmployeeRoleMappings", + column: "TenantId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "EmployeeRoleMappings"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "286516c2-0d55-439c-a8fa-b6858735ef65"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "6a84b9c0-1478-4d87-9ef6-34c00f0fca4a"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "c38971e1-491e-479f-9d02-54634c0b4908"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.Designer.cs new file mode 100644 index 0000000..5157842 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.Designer.cs @@ -0,0 +1,1913 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250217065507_addjobrole")] + partial class addjobrole + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "ad9fb730-b80a-446c-bf49-bf41f90e0c0b", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "bc153ba8-7f38-4b91-97d5-1deb230250a9", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "44e296ca-5597-44c9-9159-b481c941f902", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.cs b/Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.cs new file mode 100644 index 0000000..dbc7686 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250217065507_addjobrole.cs @@ -0,0 +1,136 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class addjobrole : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "RoleId", + table: "Employees"); + + migrationBuilder.AddColumn( + name: "JobRoleId", + table: "Employees", + type: "int", + nullable: true); + + migrationBuilder.CreateTable( + name: "JobRoles", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobRoles", x => x.Id); + table.ForeignKey( + name: "FK_JobRoles_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "ad9fb730-b80a-446c-bf49-bf41f90e0c0b"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "bc153ba8-7f38-4b91-97d5-1deb230250a9"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "44e296ca-5597-44c9-9159-b481c941f902"); + + migrationBuilder.CreateIndex( + name: "IX_Employees_JobRoleId", + table: "Employees", + column: "JobRoleId"); + + migrationBuilder.CreateIndex( + name: "IX_JobRoles_TenantId", + table: "JobRoles", + column: "TenantId"); + + migrationBuilder.AddForeignKey( + name: "FK_Employees_JobRoles_JobRoleId", + table: "Employees", + column: "JobRoleId", + principalTable: "JobRoles", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Employees_JobRoles_JobRoleId", + table: "Employees"); + + migrationBuilder.DropTable( + name: "JobRoles"); + + migrationBuilder.DropIndex( + name: "IX_Employees_JobRoleId", + table: "Employees"); + + migrationBuilder.DropColumn( + name: "JobRoleId", + table: "Employees"); + + migrationBuilder.AddColumn( + name: "RoleId", + table: "Employees", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "05db8d60-e977-40f6-b944-8602d0d4cb98"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "456ddbbe-0963-406d-8874-589a546c3670"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "19eca67f-c3b1-4e5c-8d95-c8341cf058ae"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.Designer.cs new file mode 100644 index 0000000..63a677d --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.Designer.cs @@ -0,0 +1,1913 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250302060812_CreateJobRoles")] + partial class CreateJobRoles + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ApprovedBy") + .HasColumnType("longtext"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTimeID") + .HasColumnType("int"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTimeID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("InTimeID"); + + b.HasIndex("OutTimeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CheckTime") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("IsCheckIn") + .HasColumnType("tinyint(1)"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "331a7bea-688e-4f27-8dba-697d9cd29870", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "ba873fd2-277b-4baa-88b9-22b69010ffa8", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "aa481e97-9a9b-4b1e-b9dd-0a6ce26dab47", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "InTimeLog") + .WithMany() + .HasForeignKey("InTimeID"); + + b.HasOne("Marco.Pms.Model.Employees.AttendanceLog", "OutTimeLog") + .WithMany() + .HasForeignKey("OutTimeID"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("InTimeLog"); + + b.Navigation("OutTimeLog"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.cs b/Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.cs new file mode 100644 index 0000000..c1f7d00 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250302060812_CreateJobRoles.cs @@ -0,0 +1,136 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class CreateJobRoles : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + //migrationBuilder.DropColumn( + // name: "RoleId", + // table: "Employees"); + + migrationBuilder.AddColumn( + name: "JobRoleId", + table: "Employees", + type: "int", + nullable: true); + + migrationBuilder.CreateTable( + name: "JobRoles", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Description = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_JobRoles", x => x.Id); + table.ForeignKey( + name: "FK_JobRoles_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "331a7bea-688e-4f27-8dba-697d9cd29870"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "ba873fd2-277b-4baa-88b9-22b69010ffa8"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "aa481e97-9a9b-4b1e-b9dd-0a6ce26dab47"); + + migrationBuilder.CreateIndex( + name: "IX_Employees_JobRoleId", + table: "Employees", + column: "JobRoleId"); + + migrationBuilder.CreateIndex( + name: "IX_JobRoles_TenantId", + table: "JobRoles", + column: "TenantId"); + + migrationBuilder.AddForeignKey( + name: "FK_Employees_JobRoles_JobRoleId", + table: "Employees", + column: "JobRoleId", + principalTable: "JobRoles", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Employees_JobRoles_JobRoleId", + table: "Employees"); + + migrationBuilder.DropTable( + name: "JobRoles"); + + migrationBuilder.DropIndex( + name: "IX_Employees_JobRoleId", + table: "Employees"); + + migrationBuilder.DropColumn( + name: "JobRoleId", + table: "Employees"); + + migrationBuilder.AddColumn( + name: "RoleId", + table: "Employees", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "05db8d60-e977-40f6-b944-8602d0d4cb98"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "456ddbbe-0963-406d-8874-589a546c3670"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "19eca67f-c3b1-4e5c-8d95-c8341cf058ae"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.Designer.cs new file mode 100644 index 0000000..ab78759 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.Designer.cs @@ -0,0 +1,1933 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250303045849_attendancemodule")] + partial class attendancemodule + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "04db13e4-201a-44ba-9d9a-6c07f91d3cd0", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "72e2c008-c3f1-4dd8-a6ed-19c9eec3d892", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "0a8eda0f-39b8-4efe-98af-5c6f2a7cd5cf", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendLog", b => + { + b.HasOne("Marco.Pms.Model.Employees.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.cs b/Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.cs new file mode 100644 index 0000000..7f156c6 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303045849_attendancemodule.cs @@ -0,0 +1,208 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class attendancemodule : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AttendanceLogs"); + + migrationBuilder.CreateTable( + name: "AttendLogs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + AttendanceId = table.Column(type: "int", nullable: false), + EmployeeID = table.Column(type: "int", nullable: false), + ActivityTime = table.Column(type: "datetime(6)", nullable: true), + Activity = table.Column(type: "int", nullable: false), + Photo = table.Column(type: "longblob", nullable: true), + Latitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Longitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + UpdatedOn = table.Column(type: "datetime(6)", nullable: false), + UpdatedBy = table.Column(type: "int", nullable: true), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AttendLogs", x => x.Id); + table.ForeignKey( + name: "FK_AttendLogs_Attendances_AttendanceId", + column: x => x.AttendanceId, + principalTable: "Attendances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendLogs_Employees_EmployeeID", + column: x => x.EmployeeID, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendLogs_Employees_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "Employees", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AttendLogs_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "04db13e4-201a-44ba-9d9a-6c07f91d3cd0"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "72e2c008-c3f1-4dd8-a6ed-19c9eec3d892"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "0a8eda0f-39b8-4efe-98af-5c6f2a7cd5cf"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_AttendanceId", + table: "AttendLogs", + column: "AttendanceId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_EmployeeID", + table: "AttendLogs", + column: "EmployeeID"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_TenantId", + table: "AttendLogs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_UpdatedBy", + table: "AttendLogs", + column: "UpdatedBy"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AttendLogs"); + + migrationBuilder.CreateTable( + name: "AttendanceLogs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AttendanceId = table.Column(type: "int", nullable: false), + EmployeeID = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false), + UpdatedBy = table.Column(type: "int", nullable: true), + Activity = table.Column(type: "int", nullable: false), + ActivityTime = table.Column(type: "datetime(6)", nullable: true), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Latitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Longitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Photo = table.Column(type: "longblob", nullable: true), + UpdatedOn = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AttendanceLogs", x => x.Id); + table.ForeignKey( + name: "FK_AttendanceLogs_Attendances_AttendanceId", + column: x => x.AttendanceId, + principalTable: "Attendances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendanceLogs_Employees_EmployeeID", + column: x => x.EmployeeID, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendanceLogs_Employees_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "Employees", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AttendanceLogs_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "9a70d253-1f44-411c-899a-718c344c1aea"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "aff7e2a1-8b98-49ca-a73e-b342a4d7ef90"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "dc33f0de-5730-40b0-b52b-c61ea0176c03"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_AttendanceId", + table: "AttendanceLogs", + column: "AttendanceId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_EmployeeID", + table: "AttendanceLogs", + column: "EmployeeID"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_TenantId", + table: "AttendanceLogs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_UpdatedBy", + table: "AttendanceLogs", + column: "UpdatedBy"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.Designer.cs new file mode 100644 index 0000000..dd5bbb2 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.Designer.cs @@ -0,0 +1,1933 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250303050349_renameattendancelogs")] + partial class renameattendancelogs + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendances"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "e20751cc-a482-499e-98de-ccc88689fcc6", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "589ba09f-e176-4c90-9502-707799d33e94", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "f1c5886a-474c-4b71-bda8-f278b78b0a4d", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.cs b/Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.cs new file mode 100644 index 0000000..5e5e9cc --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303050349_renameattendancelogs.cs @@ -0,0 +1,208 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class renameattendancelogs : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AttendLogs"); + + migrationBuilder.CreateTable( + name: "AttendanceLogs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + AttendanceId = table.Column(type: "int", nullable: false), + EmployeeID = table.Column(type: "int", nullable: false), + ActivityTime = table.Column(type: "datetime(6)", nullable: true), + Activity = table.Column(type: "int", nullable: false), + Photo = table.Column(type: "longblob", nullable: true), + Latitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Longitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + UpdatedOn = table.Column(type: "datetime(6)", nullable: false), + UpdatedBy = table.Column(type: "int", nullable: true), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AttendanceLogs", x => x.Id); + table.ForeignKey( + name: "FK_AttendanceLogs_Attendances_AttendanceId", + column: x => x.AttendanceId, + principalTable: "Attendances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendanceLogs_Employees_EmployeeID", + column: x => x.EmployeeID, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendanceLogs_Employees_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "Employees", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AttendanceLogs_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "e20751cc-a482-499e-98de-ccc88689fcc6"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "589ba09f-e176-4c90-9502-707799d33e94"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "f1c5886a-474c-4b71-bda8-f278b78b0a4d"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_AttendanceId", + table: "AttendanceLogs", + column: "AttendanceId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_EmployeeID", + table: "AttendanceLogs", + column: "EmployeeID"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_TenantId", + table: "AttendanceLogs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendanceLogs_UpdatedBy", + table: "AttendanceLogs", + column: "UpdatedBy"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AttendanceLogs"); + + migrationBuilder.CreateTable( + name: "AttendLogs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + AttendanceId = table.Column(type: "int", nullable: false), + EmployeeID = table.Column(type: "int", nullable: false), + TenantId = table.Column(type: "int", nullable: false), + UpdatedBy = table.Column(type: "int", nullable: true), + Activity = table.Column(type: "int", nullable: false), + ActivityTime = table.Column(type: "datetime(6)", nullable: true), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Latitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Longitude = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + Photo = table.Column(type: "longblob", nullable: true), + UpdatedOn = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AttendLogs", x => x.Id); + table.ForeignKey( + name: "FK_AttendLogs_Attendances_AttendanceId", + column: x => x.AttendanceId, + principalTable: "Attendances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendLogs_Employees_EmployeeID", + column: x => x.EmployeeID, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AttendLogs_Employees_UpdatedBy", + column: x => x.UpdatedBy, + principalTable: "Employees", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_AttendLogs_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "04db13e4-201a-44ba-9d9a-6c07f91d3cd0"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "72e2c008-c3f1-4dd8-a6ed-19c9eec3d892"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "0a8eda0f-39b8-4efe-98af-5c6f2a7cd5cf"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_AttendanceId", + table: "AttendLogs", + column: "AttendanceId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_EmployeeID", + table: "AttendLogs", + column: "EmployeeID"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_TenantId", + table: "AttendLogs", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AttendLogs_UpdatedBy", + table: "AttendLogs", + column: "UpdatedBy"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303083329_attend.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250303083329_attend.Designer.cs new file mode 100644 index 0000000..15b711b --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303083329_attend.Designer.cs @@ -0,0 +1,2003 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250303083329_attend")] + partial class attend + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attend", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendance"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "c66df186-3191-4286-b5ef-c6a4adc3a65b", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "5efb0b4b-03ab-480c-a2fd-d5a8be9e5f96", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "43e0fb8a-3d42-451c-9899-24bb033b4e70", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attend", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303083329_attend.cs b/Marco.Pms.DataAccess/Migrations/20250303083329_attend.cs new file mode 100644 index 0000000..ede525f --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303083329_attend.cs @@ -0,0 +1,242 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class attend : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_AttendanceLogs_Attendances_AttendanceId", + table: "AttendanceLogs"); + + migrationBuilder.DropForeignKey( + name: "FK_Attendances_Employees_EmployeeID", + table: "Attendances"); + + migrationBuilder.DropForeignKey( + name: "FK_Attendances_Tenants_TenantId", + table: "Attendances"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Attendances", + table: "Attendances"); + + migrationBuilder.RenameTable( + name: "Attendances", + newName: "Attendance"); + + migrationBuilder.RenameIndex( + name: "IX_Attendances_TenantId", + table: "Attendance", + newName: "IX_Attendance_TenantId"); + + migrationBuilder.RenameIndex( + name: "IX_Attendances_EmployeeID", + table: "Attendance", + newName: "IX_Attendance_EmployeeID"); + + migrationBuilder.AddColumn( + name: "RoleId", + table: "Employees", + type: "char(36)", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + collation: "ascii_general_ci"); + + migrationBuilder.AddPrimaryKey( + name: "PK_Attendance", + table: "Attendance", + column: "Id"); + + migrationBuilder.CreateTable( + name: "Attendes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Comment = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + EmployeeID = table.Column(type: "int", nullable: false), + Date = table.Column(type: "datetime(6)", nullable: false), + ProjectID = table.Column(type: "int", nullable: false), + AttendanceDate = table.Column(type: "datetime(6)", nullable: false), + InTime = table.Column(type: "datetime(6)", nullable: true), + OutTime = table.Column(type: "datetime(6)", nullable: true), + IsApproved = table.Column(type: "tinyint(1)", nullable: false), + Activity = table.Column(type: "int", nullable: false), + ApprovedBy = table.Column(type: "int", nullable: true), + TenantId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Attendes", x => x.Id); + table.ForeignKey( + name: "FK_Attendes_Employees_EmployeeID", + column: x => x.EmployeeID, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Attendes_Tenants_TenantId", + column: x => x.TenantId, + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "c66df186-3191-4286-b5ef-c6a4adc3a65b"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "5efb0b4b-03ab-480c-a2fd-d5a8be9e5f96"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "43e0fb8a-3d42-451c-9899-24bb033b4e70"); + + migrationBuilder.CreateIndex( + name: "IX_Attendes_EmployeeID", + table: "Attendes", + column: "EmployeeID"); + + migrationBuilder.CreateIndex( + name: "IX_Attendes_TenantId", + table: "Attendes", + column: "TenantId"); + + migrationBuilder.AddForeignKey( + name: "FK_Attendance_Employees_EmployeeID", + table: "Attendance", + column: "EmployeeID", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Attendance_Tenants_TenantId", + table: "Attendance", + column: "TenantId", + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AttendanceLogs_Attendance_AttendanceId", + table: "AttendanceLogs", + column: "AttendanceId", + principalTable: "Attendance", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Attendance_Employees_EmployeeID", + table: "Attendance"); + + migrationBuilder.DropForeignKey( + name: "FK_Attendance_Tenants_TenantId", + table: "Attendance"); + + migrationBuilder.DropForeignKey( + name: "FK_AttendanceLogs_Attendance_AttendanceId", + table: "AttendanceLogs"); + + migrationBuilder.DropTable( + name: "Attendes"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Attendance", + table: "Attendance"); + + migrationBuilder.DropColumn( + name: "RoleId", + table: "Employees"); + + migrationBuilder.RenameTable( + name: "Attendance", + newName: "Attendances"); + + migrationBuilder.RenameIndex( + name: "IX_Attendance_TenantId", + table: "Attendances", + newName: "IX_Attendances_TenantId"); + + migrationBuilder.RenameIndex( + name: "IX_Attendance_EmployeeID", + table: "Attendances", + newName: "IX_Attendances_EmployeeID"); + + migrationBuilder.AddPrimaryKey( + name: "PK_Attendances", + table: "Attendances", + column: "Id"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "331a7bea-688e-4f27-8dba-697d9cd29870"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "ba873fd2-277b-4baa-88b9-22b69010ffa8"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "aa481e97-9a9b-4b1e-b9dd-0a6ce26dab47"); + + migrationBuilder.AddForeignKey( + name: "FK_AttendanceLogs_Attendances_AttendanceId", + table: "AttendanceLogs", + column: "AttendanceId", + principalTable: "Attendances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Attendances_Employees_EmployeeID", + table: "Attendances", + column: "EmployeeID", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Attendances_Tenants_TenantId", + table: "Attendances", + column: "TenantId", + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.Designer.cs new file mode 100644 index 0000000..a840623 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.Designer.cs @@ -0,0 +1,1933 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250303085119_attendrename")] + partial class attendrename + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "6962167a-70de-4e3d-961d-14cfe676ef22", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "d8d0ed22-ce17-4a73-b507-307c43c08b57", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "3c0463c6-2842-43ac-b7d3-ca74b26c74a6", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.cs b/Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.cs new file mode 100644 index 0000000..0ef5490 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250303085119_attendrename.cs @@ -0,0 +1,117 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class attendrename : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + migrationBuilder.DropForeignKey( + name: "FK_AttendanceLogs_Attendance_AttendanceId", + table: "AttendanceLogs"); + + + migrationBuilder.DropTable( + name: "Attendance"); + + + migrationBuilder.AddForeignKey( + name: "FK_AttendanceLogs_Attendes_AttendanceId", + table: "AttendanceLogs", + column: "AttendanceId", + principalTable: "Attendes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_AttendanceLogs_Attendes_AttendanceId", + table: "AttendanceLogs"); + + migrationBuilder.DropForeignKey( + name: "FK_Attendes_Employees_EmployeeID", + table: "Attendes"); + + migrationBuilder.DropForeignKey( + name: "FK_Attendes_Tenants_TenantId", + table: "Attendes"); + + migrationBuilder.DropPrimaryKey( + name: "PK_Attendes", + table: "Attendes"); + + migrationBuilder.RenameTable( + name: "Attendes", + newName: "Attendances"); + + migrationBuilder.RenameIndex( + name: "IX_Attendes_TenantId", + table: "Attendances", + newName: "IX_Attendances_TenantId"); + + migrationBuilder.RenameIndex( + name: "IX_Attendes_EmployeeID", + table: "Attendances", + newName: "IX_Attendances_EmployeeID"); + + migrationBuilder.AddPrimaryKey( + name: "PK_Attendances", + table: "Attendances", + column: "Id"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "02f1b9b7-9cc5-4822-8090-362ca9b61a8e"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "b9005cdc-0d10-4110-9e42-1d7117b68cd3"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "6df40548-5543-4066-aab4-5f340015b731"); + + migrationBuilder.AddForeignKey( + name: "FK_AttendanceLogs_Attendances_AttendanceId", + table: "AttendanceLogs", + column: "AttendanceId", + principalTable: "Attendances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Attendances_Employees_EmployeeID", + table: "Attendances", + column: "EmployeeID", + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Attendances_Tenants_TenantId", + table: "Attendances", + column: "TenantId", + principalTable: "Tenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.Designer.cs b/Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.Designer.cs new file mode 100644 index 0000000..4de4b2b --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.Designer.cs @@ -0,0 +1,1936 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250311072410_addIsActiveToProjectAllocation")] + partial class addIsActiveToProjectAllocation + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + // MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.cs b/Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.cs new file mode 100644 index 0000000..a721a20 --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/20250311072410_addIsActiveToProjectAllocation.cs @@ -0,0 +1,71 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + /// + public partial class addIsActiveToProjectAllocation : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsActive", + table: "ProjectAllocations", + type: "tinyint(1)", + nullable: false, + defaultValue: false); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "b04da7e9-0406-409c-ac7f-b97256e6ea02"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "0971c7fb-6ce1-458a-ae3f-8d3205893637"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "504ec132-e6a9-422f-8f85-050602cfce05"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsActive", + table: "ProjectAllocations"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 1, + column: "Key", + value: "6962167a-70de-4e3d-961d-14cfe676ef22"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 2, + column: "Key", + value: "d8d0ed22-ce17-4a73-b507-307c43c08b57"); + + migrationBuilder.UpdateData( + table: "Modules", + keyColumn: "Id", + keyValue: 3, + column: "Key", + value: "3c0463c6-2842-43ac-b7d3-ca74b26c74a6"); + } + } +} diff --git a/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs new file mode 100644 index 0000000..3d0eafd --- /dev/null +++ b/Marco.Pms.DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs @@ -0,0 +1,1933 @@ +// +using System; +using Marco.Pms.DataAccess.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Marco.Pms.DataAccess.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + partial class ApplicationDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + //MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRole") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("TaskAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityId") + .HasColumnType("int"); + + b.Property("CompletedWork") + .HasColumnType("int"); + + b.Property("PlannedWork") + .HasColumnType("int"); + + b.Property("TaskDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ActivityId"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.ToTable("WorkItems"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WorkAreaId") + .HasColumnType("int"); + + b.Property("WorkItemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.HasIndex("WorkAreaId"); + + b.HasIndex("WorkItemId"); + + b.ToTable("WorkItemMapping"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ApprovedBy") + .HasColumnType("int"); + + b.Property("AttendanceDate") + .HasColumnType("datetime(6)"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Date") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("InTime") + .HasColumnType("datetime(6)"); + + b.Property("IsApproved") + .HasColumnType("tinyint(1)"); + + b.Property("OutTime") + .HasColumnType("datetime(6)"); + + b.Property("ProjectID") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.ToTable("Attendes"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Activity") + .HasColumnType("int"); + + b.Property("ActivityTime") + .HasColumnType("datetime(6)"); + + b.Property("AttendanceId") + .HasColumnType("int"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EmployeeID") + .HasColumnType("int"); + + b.Property("Latitude") + .HasColumnType("longtext"); + + b.Property("Longitude") + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UpdatedBy") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("AttendanceId"); + + b.HasIndex("EmployeeID"); + + b.HasIndex("TenantId"); + + b.HasIndex("UpdatedBy"); + + b.ToTable("AttendanceLogs"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ExpiryDate") + .HasColumnType("datetime(6)"); + + b.Property("IsRevoked") + .HasColumnType("tinyint(1)"); + + b.Property("IsUsed") + .HasColumnType("tinyint(1)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("Token") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RefreshTokens"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AadharNumber") + .HasColumnType("longtext"); + + b.Property("ApplicationUserId") + .HasColumnType("varchar(255)"); + + b.Property("BirthDate") + .HasColumnType("datetime(6)"); + + b.Property("CurrentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Email") + .HasColumnType("longtext"); + + b.Property("EmergencyPhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Gender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("JobRoleId") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("MiddleName") + .HasColumnType("longtext"); + + b.Property("PanNumber") + .HasColumnType("longtext"); + + b.Property("PeramnentAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Photo") + .HasColumnType("longblob"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationUserId"); + + b.HasIndex("JobRoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EndTime") + .HasColumnType("time(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("StartTime") + .HasColumnType("time(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkShifts"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ActivityName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TaskAllocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UnitOfMeasurement") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TaskAllocationId"); + + b.HasIndex("TenantId"); + + b.ToTable("ActivityMasters"); + + b.HasData( + new + { + Id = 1, + ActivityName = "Core Cutting", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 2, + ActivityName = "Fabrication", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 3, + ActivityName = "Lifting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 4, + ActivityName = "Hanging", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 5, + ActivityName = "Tapping", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 6, + ActivityName = "Welding", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 7, + ActivityName = "Testing", + TenantId = 1, + UnitOfMeasurement = "Area" + }, + new + { + Id = 8, + ActivityName = "Painting", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 9, + ActivityName = "Marking Area", + TenantId = 1, + UnitOfMeasurement = "Meter" + }, + new + { + Id = 10, + ActivityName = "Drilling", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 11, + ActivityName = "MS Support Fabrication", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 12, + ActivityName = "MS Support Hanging", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 13, + ActivityName = "Hydrant Volve", + TenantId = 1, + UnitOfMeasurement = "Number" + }, + new + { + Id = 14, + ActivityName = "Sprinkler Installation", + TenantId = 1, + UnitOfMeasurement = "Number" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("ApplicationRoles"); + + b.HasData( + new + { + Id = new Guid("2c8d0808-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Admin", + TenantId = 1 + }, + new + { + Id = new Guid("62e0918d-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Welder", + TenantId = 1 + }, + new + { + Id = new Guid("68823f1f-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Helper", + TenantId = 1 + }, + new + { + Id = new Guid("6d3a7c72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Site Engineer", + TenantId = 1 + }, + new + { + Id = new Guid("6d3aad72-c421-11ef-9b93-0242ac110002"), + Description = "", + Role = "Project Manager", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("RoleId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId"); + + b.ToTable("EmployeeRoleMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ModuleId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("ModuleId"); + + b.ToTable("Features"); + + b.HasData( + new + { + Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + Description = "Manage Project", + IsActive = true, + ModuleId = 1, + Name = "Manage Project" + }, + new + { + Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + Description = "Manage Infra", + IsActive = true, + ModuleId = 1, + Name = "Manage Infra" + }, + new + { + Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + Description = "Manage Tasks", + IsActive = true, + ModuleId = 1, + Name = "Manage Tasks" + }, + new + { + Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + Description = "Assign and Update Tasks Progress", + IsActive = true, + ModuleId = 1, + Name = "Assign and Update Tasks Progress" + }, + new + { + Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + Description = "Manage Employee", + IsActive = true, + ModuleId = 2, + Name = "Manage Employee" + }, + new + { + Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + Description = "Attendance", + IsActive = true, + ModuleId = 2, + Name = "Attendance" + }, + new + { + Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + Description = "Global Masters", + IsActive = true, + ModuleId = 3, + Name = "Global Masters" + }, + new + { + Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + Description = "Tenant Masters", + IsActive = true, + ModuleId = 3, + Name = "Tenant Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FeatureId") + .HasColumnType("char(36)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("FeatureId"); + + b.ToTable("FeaturePermissions"); + + b.HasData( + new + { + Id = new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "View Project" + }, + new + { + Id = new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Project" + }, + new + { + Id = new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), + Description = "", + FeatureId = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), + IsEnabled = true, + Name = "Manage Team" + }, + new + { + Id = new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "View Project Infra" + }, + new + { + Id = new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), + Description = "", + FeatureId = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), + IsEnabled = true, + Name = "Manage Project Infra" + }, + new + { + Id = new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "View Task" + }, + new + { + Id = new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), + Description = "", + FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), + IsEnabled = true, + Name = "Manage Task" + }, + new + { + Id = new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Assign Task and Report Progress" + }, + new + { + Id = new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), + Description = "", + FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), + IsEnabled = true, + Name = "Approve Task" + }, + new + { + Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "View Employee" + }, + new + { + Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Manage Employee" + }, + new + { + Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), + Description = "", + FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), + IsEnabled = true, + Name = "Assign To Project" + }, + new + { + Id = new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Perform Attendance " + }, + new + { + Id = new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), + Description = "", + FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), + IsEnabled = true, + Name = "Regularize Attendance" + }, + new + { + Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), + Description = "", + FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), + IsEnabled = true, + Name = "Manage Masters" + }, + new + { + Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "View Masters" + }, + new + { + Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), + Description = "", + FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), + IsEnabled = true, + Name = "Manage Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("JobRoles"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Module", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Key") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("Modules"); + + b.HasData( + new + { + Id = 1, + Description = "Project Module", + Key = "b04da7e9-0406-409c-ac7f-b97256e6ea02", + Name = "Project" + }, + new + { + Id = 2, + Description = "Employee Module", + Key = "0971c7fb-6ce1-458a-ae3f-8d3205893637", + Name = "Employee" + }, + new + { + Id = 3, + Description = "Masters Module", + Key = "504ec132-e6a9-422f-8f85-050602cfce05", + Name = "Masters" + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.Property("ApplicationRoleId") + .HasColumnType("char(36)"); + + b.Property("FeaturePermissionId") + .HasColumnType("char(36)"); + + b.HasKey("ApplicationRoleId", "FeaturePermissionId"); + + b.HasIndex("FeaturePermissionId"); + + b.ToTable("RolePermissionMappings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Status") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("StatusMasters"); + + b.HasData( + new + { + Id = 1, + Status = "Active", + TenantId = 1 + }, + new + { + Id = 2, + Status = "In Progress", + TenantId = 1 + }, + new + { + Id = 3, + Status = "On Hold", + TenantId = 1 + }, + new + { + Id = 4, + Status = "Completed", + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ContactNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Description") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("DomainName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("OnBoardingDate") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("Tenants"); + + b.HasData( + new + { + Id = 1, + ContactName = "Admin", + ContactNumber = "123456789", + Description = "", + DomainName = "www.marcobms.org", + Name = "MarcoBMS", + OnBoardingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Buildings"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BuildingId") + .HasColumnType("int"); + + b.Property("FloorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BuildingId"); + + b.HasIndex("TenantId"); + + b.ToTable("Floor"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ContactPerson") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("EndDate") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectAddress") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProjectStatusId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectStatusId"); + + b.HasIndex("TenantId"); + + b.ToTable("Projects"); + + b.HasData( + new + { + Id = 1, + ContactPerson = "Project 1 Contact Person", + Name = "Project 1", + ProjectAddress = "Project 1 Address", + ProjectStatusId = 1, + TenantId = 1 + }, + new + { + Id = 2, + ContactPerson = "Project 2 Contact Person", + Name = "Project 2", + ProjectAddress = "Project 2 Address", + ProjectStatusId = 2, + TenantId = 1 + }, + new + { + Id = 3, + ContactPerson = "Project 3 Contact Person", + Name = "Project 3", + ProjectAddress = "Project 3 Address", + ProjectStatusId = 3, + TenantId = 1 + }); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("EmployeeId") + .HasColumnType("int"); + + b.Property("EmployeeRoleId") + .HasColumnType("char(36)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("ProjectId") + .HasColumnType("int"); + + b.Property("ReAllocationDate") + .HasColumnType("datetime(6)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("ProjectId"); + + b.HasIndex("TenantId"); + + b.ToTable("ProjectAllocations"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("FloorId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FloorId"); + + b.HasIndex("TenantId"); + + b.ToTable("WorkAreas"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("varchar(255)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasDiscriminator().HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("varchar(255)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("RoleId") + .HasColumnType("varchar(255)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("varchar(255)"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationUser", b => + { + b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser"); + + b.Property("IsRootUser") + .HasColumnType("tinyint(1)"); + + b.Property("Role") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("ApplicationUser"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItem", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ActivityMaster", "ActivityMaster") + .WithMany() + .HasForeignKey("ActivityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ActivityMaster"); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.WorkItemMapping", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.WorkArea", "WorkArea") + .WithMany() + .HasForeignKey("WorkAreaId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Activities.WorkItem", "WorkItem") + .WithMany() + .HasForeignKey("WorkItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + + b.Navigation("WorkArea"); + + b.Navigation("WorkItem"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.Attendance", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Approver") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Approver"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.AttendanceModule.AttendanceLog", b => + { + b.HasOne("Marco.Pms.Model.AttendanceModule.Attendance", "Attendance") + .WithMany() + .HasForeignKey("AttendanceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Employees.Employee", "UpdatedByEmployee") + .WithMany() + .HasForeignKey("UpdatedBy"); + + b.Navigation("Attendance"); + + b.Navigation("Employee"); + + b.Navigation("Tenant"); + + b.Navigation("UpdatedByEmployee"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Authentication.RefreshToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.Employee", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationUser", "ApplicationUser") + .WithMany() + .HasForeignKey("ApplicationUserId"); + + b.HasOne("Marco.Pms.Model.Entitlements.JobRole", "JobRole") + .WithMany() + .HasForeignKey("JobRoleId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationUser"); + + b.Navigation("JobRole"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Employees.WorkShift", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ActivityMaster", b => + { + b.HasOne("Marco.Pms.Model.Activities.TaskAllocation", null) + .WithMany("AllotedTask") + .HasForeignKey("TaskAllocationId"); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.ApplicationRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.EmployeeRoleMapping", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Role"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Module", "Module") + .WithMany() + .HasForeignKey("ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.FeaturePermission", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Feature", "Feature") + .WithMany("FeaturePermissions") + .HasForeignKey("FeatureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Feature"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.JobRole", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.RolePermissionMappings", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.ApplicationRole", null) + .WithMany() + .HasForeignKey("ApplicationRoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.FeaturePermission", null) + .WithMany() + .HasForeignKey("FeaturePermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.StatusMaster", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Building", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Floor", b => + { + b.HasOne("Marco.Pms.Model.Projects.Building", "Building") + .WithMany() + .HasForeignKey("BuildingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Building"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.Project", b => + { + b.HasOne("Marco.Pms.Model.Entitlements.StatusMaster", "ProjectStatus") + .WithMany() + .HasForeignKey("ProjectStatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProjectStatus"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.ProjectAllocation", b => + { + b.HasOne("Marco.Pms.Model.Employees.Employee", "Employee") + .WithMany() + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Projects.Project", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Project"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Projects.WorkArea", b => + { + b.HasOne("Marco.Pms.Model.Projects.Floor", "Floor") + .WithMany() + .HasForeignKey("FloorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Floor"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Marco.Pms.Model.Activities.TaskAllocation", b => + { + b.Navigation("AllotedTask"); + }); + + modelBuilder.Entity("Marco.Pms.Model.Entitlements.Feature", b => + { + b.Navigation("FeaturePermissions"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/ActivityMasterRepository.cs b/Marco.Pms.DataAccess/Repository/ActivityMasterRepository.cs new file mode 100644 index 0000000..f78b06b --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/ActivityMasterRepository.cs @@ -0,0 +1,47 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.EntityFrameworkCore; +using System.Linq.Expressions; +using System.Linq; + +namespace BulkyBook.DataAccess.Repository +{ + public class ActivityMasterRepository : Repository, IActivityMasterRepository + { + private readonly ApplicationDbContext _context; + public ActivityMasterRepository(ApplicationDbContext context) : base(context) + { + _context = context; + } + + + public void Update(ActivityMaster status) + { + _context.ActivityMasters.Update(status); + } + + public Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null) + { + + IQueryable query = _context.ActivityMasters; + if (filter != null) + { + query.Where(filter); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + return query.ToListAsync(); + + + // return await _context.Projects.ToListAsync(); ; + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/ApplicationRolesRepository.cs b/Marco.Pms.DataAccess/Repository/ApplicationRolesRepository.cs new file mode 100644 index 0000000..cb13bc5 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/ApplicationRolesRepository.cs @@ -0,0 +1,23 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; + +namespace BulkyBook.DataAccess.Repository +{ + public class ApplicationRolesRepository : Repository, IApplicationRolesRepository + { + private readonly ApplicationDbContext _db; + public ApplicationRolesRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(ApplicationRole status) + { + _db.ApplicationRoles.Update(status); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/ApplicationUserRepository.cs b/Marco.Pms.DataAccess/Repository/ApplicationUserRepository.cs new file mode 100644 index 0000000..25b7f3b --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/ApplicationUserRepository.cs @@ -0,0 +1,21 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Entitlements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.DataAccess.Repository +{ + public class ApplicationUserRepository : Repository, IApplicationUserRepository + { + private readonly ApplicationDbContext _db; + public ApplicationUserRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + } +} diff --git a/Marco.Pms.DataAccess/Repository/AttendenceRepository.cs b/Marco.Pms.DataAccess/Repository/AttendenceRepository.cs new file mode 100644 index 0000000..2191975 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/AttendenceRepository.cs @@ -0,0 +1,22 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.AttendanceModule; + +namespace BulkyBook.DataAccess.Repository +{ + public class AttendenceRepository : Repository, IAttendenceRepository + { + private readonly ApplicationDbContext _db; + public AttendenceRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(Attendance attendance) + { + _db.Attendes.Update(attendance); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/BuildingRepository.cs b/Marco.Pms.DataAccess/Repository/BuildingRepository.cs new file mode 100644 index 0000000..9d73d93 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/BuildingRepository.cs @@ -0,0 +1,22 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Projects; + +namespace BulkyBook.DataAccess.Repository +{ + public class BuildingRepository : Repository, IBuildingRepository + { + private readonly ApplicationDbContext _db; + public BuildingRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(Building building) + { + _db.Buildings.Update(building); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/EmployeeRepository.cs b/Marco.Pms.DataAccess/Repository/EmployeeRepository.cs new file mode 100644 index 0000000..6c4942e --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/EmployeeRepository.cs @@ -0,0 +1,47 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Projects; +using Microsoft.EntityFrameworkCore; +using System.Linq.Expressions; +using System.Linq; + +namespace BulkyBook.DataAccess.Repository +{ + public class EmployeeRepository : Repository, IEmployeeRepository + { + private readonly ApplicationDbContext _context; + public EmployeeRepository(ApplicationDbContext db) : base(db) + { + _context = db; + } + + + public void Update(Employee employee) + { + _context.Employees.Update(employee); + } + + public Task> GetAsync(Expression>? filter = null, string? includeProperties = null) + { + + IQueryable query = _context.Employees; + if (filter != null) + { + query.Where(filter); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + return query.ToListAsync(); + + + // return await _context.Projects.ToListAsync(); ; + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/FeaturesRepository.cs b/Marco.Pms.DataAccess/Repository/FeaturesRepository.cs new file mode 100644 index 0000000..689a880 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/FeaturesRepository.cs @@ -0,0 +1,119 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.EntityFrameworkCore; +using System.Linq.Expressions; + +namespace BulkyBook.DataAccess.Repository +{ + public class FeaturesRepository : Repository, IFeatureRepository + { + private readonly ApplicationDbContext _context; + internal DbSet dbSet; + + public FeaturesRepository(ApplicationDbContext db): base(db) + { + _context = db; + this.dbSet = _context.Set(); + + } + + + public void Update(Feature project) + { + _context.Features.Update(project); + } + + + public Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null) + { + + IQueryable query = _context.Features; + if (filter != null) + { + query.Where(filter); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + return query.ToListAsync(); + + + // return await _context.Projects.ToListAsync(); ; + } + public Task> GetAsync(Expression>? filter = null, string? includeProperties = null) + { + + IQueryable query = _context.Features; + + if (filter != null) + { + query.Where(filter); + //var projects1= query2.Where(filter).ToListAsync(); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + + return query.ToListAsync(); + + + // return await _context.Projects.ToListAsync(); ; + } + + public async Task CreateAsync(Feature projectModel) + { + try + { + await _context.Features.AddAsync(projectModel); + await _context.SaveChangesAsync(); + return projectModel; + } + catch (Exception ex) { throw ex; } + + } + + + + //public async Task UpdateAsync(int id, UpdateFeatureDto projectDto) + //{ + + // var projectModel = await _context.Features.FirstOrDefaultAsync(item => item.Id == id); + + // if (projectModel == null) + // { + // return null; + // } + + // projectModel.ContactPerson = projectDto.ContactPerson; + // projectModel.ProjectAddress = projectDto.ProjectAddress; + // projectModel.Name = projectDto.Name; + // projectModel.EndDate = projectDto.EndDate; + // projectModel.StartDate = projectDto.StartDate; + // //projectModel.TenantId = projectDto.TenantId; + // try + // { + // await _context.SaveChangesAsync(); + // }catch(Exception ex ) + // { + // throw ex; + // } + + // return projectModel; + //} + + + + + } +} diff --git a/Marco.Pms.DataAccess/Repository/FloorRepository.cs b/Marco.Pms.DataAccess/Repository/FloorRepository.cs new file mode 100644 index 0000000..202fdbb --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/FloorRepository.cs @@ -0,0 +1,22 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Projects; + +namespace BulkyBook.DataAccess.Repository +{ + public class FloorRepository : Repository, IFloorRepository + { + private readonly ApplicationDbContext _db; + public FloorRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(Floor floor) + { + _db.Floor.Update(floor); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IActivityMasterRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IActivityMasterRepository.cs new file mode 100644 index 0000000..71fe429 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IActivityMasterRepository.cs @@ -0,0 +1,12 @@ +using Marco.Pms.Model.Entitlements; +using System.Linq.Expressions; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IActivityMasterRepository : IRepository + { + void Update(ActivityMaster activity); + Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IApplicationRolesRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IApplicationRolesRepository.cs new file mode 100644 index 0000000..df57350 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IApplicationRolesRepository.cs @@ -0,0 +1,10 @@ +using Marco.Pms.Model.Entitlements; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IApplicationRolesRepository : IRepository + { + void Update(ApplicationRole role); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IApplicationUserRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IApplicationUserRepository.cs new file mode 100644 index 0000000..7feb37b --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IApplicationUserRepository.cs @@ -0,0 +1,9 @@ +using Marco.Pms.Model.Entitlements; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IApplicationUserRepository : IRepository + { + + } +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IAttendenceRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IAttendenceRepository.cs new file mode 100644 index 0000000..6a3c67e --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IAttendenceRepository.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.AttendanceModule; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + + public interface IAttendenceRepository : IRepository + { + void Update(Attendance employee); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IBuildingRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IBuildingRepository.cs new file mode 100644 index 0000000..aedd6f3 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IBuildingRepository.cs @@ -0,0 +1,10 @@ +using Marco.Pms.Model.Projects; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IBuildingRepository : IRepository + { + void Update(Building building); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IEmployeeRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IEmployeeRepository.cs new file mode 100644 index 0000000..ab48ec0 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IEmployeeRepository.cs @@ -0,0 +1,13 @@ +using Marco.Pms.Model.Employees; +using System.Linq.Expressions; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + + public interface IEmployeeRepository : IRepository + { + void Update(Employee employee); + Task> GetAsync(Expression>? filter = null, string? includeProperties = null); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IFeatureRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IFeatureRepository.cs new file mode 100644 index 0000000..b35b898 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IFeatureRepository.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Entitlements; +using System.Linq.Expressions; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IFeatureRepository : IRepository + { + void Update(Feature Feature); + Task> GetAsync(Expression>? filter = null, string? includeProperties = null); + Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null); + Task CreateAsync(Feature feature); + // Task UpdateAsync(int id, UpdateFeatureDto Feature); + + // Task> GetAsync(int id, string? includeProperties = null); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IFloorRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IFloorRepository.cs new file mode 100644 index 0000000..fcaf538 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IFloorRepository.cs @@ -0,0 +1,10 @@ +using Marco.Pms.Model.Projects; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IFloorRepository : IRepository + { + void Update(Floor floor); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IProjectAllocationRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IProjectAllocationRepository.cs new file mode 100644 index 0000000..6e9f128 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IProjectAllocationRepository.cs @@ -0,0 +1,20 @@ +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Projects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IProjectAllocationRepository + { + void Update(ProjectAllocation project); + Task> GetAsync(Expression>? filter = null, string? includeProperties = null); + Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null); + Task CreateAsync(ProjectAllocation project); + Task UpdateAsync(int id, ProjectAllocation project); + } +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IProjectRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IProjectRepository.cs new file mode 100644 index 0000000..ca9c902 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IProjectRepository.cs @@ -0,0 +1,18 @@ +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Projects; +using System.Linq.Expressions; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IProjectRepository : IRepository + { + void Update(Project project); + Task> GetAsync(Expression>? filter = null, string? includeProperties = null); + Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null); + Task CreateAsync(Project project); + Task UpdateAsync(int id, UpdateProjectDto project); + + // Task> GetAsync(int id, string? includeProperties = null); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IRepository.cs new file mode 100644 index 0000000..073b6f0 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IRepository.cs @@ -0,0 +1,16 @@ +using System.Linq.Expressions; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IRepository where T : class + { + // T - Category + IEnumerable GetAll(Expression>? filter, string? includeProperties = null); + //T GetFirstOrDefault(); + T Get(Expression> filter, string? includeProperties = null, bool tracked = false); + Task GetAsync(Expression> filter, bool tracked = false, params Expression>[] includeProperties); + void Add(T entity); + void Remove(T entity); + void RemoveRange(IEnumerable entity); + } +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IStatusRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IStatusRepository.cs new file mode 100644 index 0000000..f86139b --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IStatusRepository.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IStatusRepository : IRepository + { + void Update(StatusMaster status); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/ITaskAllocationRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/ITaskAllocationRepository.cs new file mode 100644 index 0000000..00b07b1 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/ITaskAllocationRepository.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Activities; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + + public interface ITaskAllocationRepository : IRepository + { + void Update(TaskAllocation employeeAllocation); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IUnitOfWork.cs b/Marco.Pms.DataAccess/Repository/IRepository/IUnitOfWork.cs new file mode 100644 index 0000000..0994eba --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IUnitOfWork.cs @@ -0,0 +1,28 @@ +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IUnitOfWork + { + IApplicationUserRepository ApplicationUser { get; } + + IEmployeeRepository Employee { get; } + ITaskAllocationRepository EmployeeAllocation + { get; } + IProjectRepository Project { get; } + IProjectAllocationRepository ProjectAllocation { get; } + + IBuildingRepository Building { get; } + IFloorRepository Floor { get; } + + IWorkAreaRepository WorkArea { get; } + IWorkItemRepository WorkItem { get; } + IWorkItemMappingReposiotry WorkItemMapping { get;} + + + IAttendenceRepository Attendence { get; } + IStatusRepository StatusMaster { get; } + IActivityMasterRepository ActivityMaster { get; } + IApplicationRolesRepository EmployeeRoles { get; } + IFeatureRepository Features { get; } + void Save(); + } +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IWorkAreaRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IWorkAreaRepository.cs new file mode 100644 index 0000000..7ae68d6 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IWorkAreaRepository.cs @@ -0,0 +1,10 @@ +using Marco.Pms.Model.Projects; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IWorkAreaRepository : IRepository + { + void Update(WorkArea workArea); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IWorkItemMappingReposiotry.cs b/Marco.Pms.DataAccess/Repository/IRepository/IWorkItemMappingReposiotry.cs new file mode 100644 index 0000000..c6f0cbc --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IWorkItemMappingReposiotry.cs @@ -0,0 +1,9 @@ +using Marco.Pms.Model.Activities; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IWorkItemMappingReposiotry : IRepository + { + void Update(WorkItemMapping mapping); + } +} diff --git a/Marco.Pms.DataAccess/Repository/IRepository/IWorkItemRepository.cs b/Marco.Pms.DataAccess/Repository/IRepository/IWorkItemRepository.cs new file mode 100644 index 0000000..0ee149e --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/IRepository/IWorkItemRepository.cs @@ -0,0 +1,11 @@ +using Marco.Pms.Model.Activities; +using Marco.Pms.Model.Projects; + +namespace Marco.Pms.DataAccess.Repository.IRepository +{ + public interface IWorkItemRepository : IRepository + { + void Update(WorkItem workItem); + } + +} diff --git a/Marco.Pms.DataAccess/Repository/ProjectAllocationRepository.cs b/Marco.Pms.DataAccess/Repository/ProjectAllocationRepository.cs new file mode 100644 index 0000000..ca356bd --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/ProjectAllocationRepository.cs @@ -0,0 +1,84 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Projects; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.DataAccess.Repository +{ + public class ProjectAllocationRepository : Repository, IProjectAllocationRepository + { + private readonly ApplicationDbContext _context; + internal DbSet dbSet; + + public ProjectAllocationRepository(ApplicationDbContext db) : base(db) + { + _context = db; + this.dbSet = _context.Set(); + } + + + public void Update(ProjectAllocation project) + { + _context.ProjectAllocations.Update(project); + } + + public async Task CreateAsync(ProjectAllocation project) + { + await _context.ProjectAllocations.AddAsync(project); + await _context.SaveChangesAsync(); + return project; + } + + public Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null) + { + throw new NotImplementedException(); + } + + public Task> GetAsync(Expression>? filter = null, string? includeProperties = null) + { + IQueryable query = _context.ProjectAllocations; + if (filter != null) + { + query.Where(filter); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + return query.ToListAsync(); + } + + + public async Task UpdateAsync(int id, ProjectAllocation project) + { + var allocation = await _context.ProjectAllocations.FirstOrDefaultAsync(item => item.Id == id); + + if (allocation == null) + { + return null; + } + + allocation.ProjectId = project.ProjectId; + allocation.EmployeeId = project.EmployeeId; + allocation.AllocationDate = project.AllocationDate; + allocation.ReAllocationDate = project.ReAllocationDate; + allocation.TenantId = project.TenantId; + + + _context.ProjectAllocations.Update(allocation); + await _context.SaveChangesAsync(); + + return allocation; + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/ProjectRepository.cs b/Marco.Pms.DataAccess/Repository/ProjectRepository.cs new file mode 100644 index 0000000..bed7d6c --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/ProjectRepository.cs @@ -0,0 +1,146 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.EntityFrameworkCore; +using System.Linq; +using System.Linq.Expressions; +using System.Xml; +using System.Xml.Linq; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; + +namespace BulkyBook.DataAccess.Repository +{ + public class ProjectRepository : Repository, IProjectRepository + { + private readonly ApplicationDbContext _context; + internal DbSet dbSet; + + public ProjectRepository(ApplicationDbContext db) : base(db) + { + _context = db; + this.dbSet = _context.Set(); + + } + + + public void Update(Project project) + { + _context.Projects.Update(project); + } + + + public Task> GetAllAsync(Expression>? filter = null, string? includeProperties = null) + { + + IQueryable query = _context.Projects; + if (filter != null) + { + query.Where(filter); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + return query.ToListAsync(); + + + // return await _context.Projects.ToListAsync(); ; + } + public Task> GetAsync(Expression>? filter = null, string? includeProperties = null) + { + + IQueryable query = _context.Projects; + //IQueryable query2 = _context.Projects; + + Expression> filter1 = x => x.Id == 2; + if (filter != null) + { + query.Where(filter); + //var projects1= query2.Where(filter).ToListAsync(); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + + return query.ToListAsync(); + + + // return await _context.Projects.ToListAsync(); ; + } + + public async Task CreateAsync(Project projectModel) + { + try + { + await _context.Projects.AddAsync(projectModel); + await _context.SaveChangesAsync(); + return projectModel; + } + catch (Exception ex) { throw ex; } + + } + + public async Task UpdateAsync(int id, UpdateProjectDto projectDto) + { + + var projectModel = await _context.Projects.FirstOrDefaultAsync(item => item.Id == id); + + if (projectModel == null) + { + return null; + } + + projectModel.ContactPerson = projectDto.ContactPerson; + projectModel.ProjectAddress = projectDto.ProjectAddress; + projectModel.Name = projectDto.Name; + projectModel.EndDate = projectDto.EndDate; + projectModel.StartDate = projectDto.StartDate; + //projectModel.TenantId = projectDto.TenantId; + try + { + await _context.SaveChangesAsync(); + }catch(Exception ex ) + { + throw ex; + } + + return projectModel; + } + + + + //public Task> GetAsync(int id, string? includeProperties = null) + //{ + + // IQueryable query = _context.Projects; + // query.Where(c=>c.Id == id); + // // Task project = _context.Projects.Where(c=>c.Id == id).SingleOrDefaultAsync(); + // //if (filter != null) + // //{ + // // query.Where(filter); + // //} + // //if (!string.IsNullOrEmpty(includeProperties)) + // //{ + // // foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + // // { + // // query = query.Include(includeProp); + // // } + // //} + // return query.ToListAsync(); + + + // // return await _context.Projects.ToListAsync(); ; + //} + + } +} diff --git a/Marco.Pms.DataAccess/Repository/Repository.cs b/Marco.Pms.DataAccess/Repository/Repository.cs new file mode 100644 index 0000000..7b69363 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/Repository.cs @@ -0,0 +1,102 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; +using Microsoft.EntityFrameworkCore; +using System.Linq.Expressions; + +namespace Marco.Pms.DataAccess.Repository +{ + public class Repository : IRepository where T : class + { + private readonly ApplicationDbContext _context; + internal DbSet dbSet; + public Repository(ApplicationDbContext context) + { + _context = context; + this.dbSet = _context.Set(); + + //_db.Products.Include(u => u.Category); + } + public void Add(T entity) + { + dbSet.Add(entity); + } + + public T Get(Expression> filter, string? includeProperties = null, bool tracked = false) + { + IQueryable query = dbSet; + if (tracked) + { + query = query.Where(filter); + } + else + { + query = query.AsNoTracking().Where(filter); + } + + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + + return query.FirstOrDefault(); + + } + + public async Task GetAsync(Expression> filter, bool tracked = false, params Expression>[] includeProperties) + { + IQueryable query = dbSet; + if (tracked) + { + query = query.Where(filter); + } + else + { + query = query.AsNoTracking().Where(filter); + } + + if (includeProperties != null) + { + foreach (var includeProp in includeProperties) + { + query = query.Include(includeProp); + } + } + + return await query.SingleOrDefaultAsync(); + + } + + public IEnumerable GetAll(Expression>? filter = null, string? includeProperties = null) + { + IQueryable query = dbSet; + if(filter != null) + { + query.Where(filter); + } + if (!string.IsNullOrEmpty(includeProperties)) + { + foreach (var includeProp in includeProperties.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + { + query = query.Include(includeProp); + } + } + return query.ToList(); + + } + + public void Remove(T entity) + { + dbSet.Remove(entity); + } + + public void RemoveRange(IEnumerable entity) + { + dbSet.RemoveRange(entity); + } + + + } +} diff --git a/Marco.Pms.DataAccess/Repository/StatusRepository.cs b/Marco.Pms.DataAccess/Repository/StatusRepository.cs new file mode 100644 index 0000000..2d9c92d --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/StatusRepository.cs @@ -0,0 +1,23 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; + +namespace BulkyBook.DataAccess.Repository +{ + public class StatusRepository : Repository, IStatusRepository + { + private readonly ApplicationDbContext _db; + public StatusRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(StatusMaster status) + { + _db.StatusMasters.Update(status); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/TaskAllocationRepository.cs b/Marco.Pms.DataAccess/Repository/TaskAllocationRepository.cs new file mode 100644 index 0000000..13521f4 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/TaskAllocationRepository.cs @@ -0,0 +1,21 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Activities; + +namespace BulkyBook.DataAccess.Repository +{ + public class TaskAllocationRepository : Repository, ITaskAllocationRepository + { + private readonly ApplicationDbContext _db; + public TaskAllocationRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + public void Update(TaskAllocation employeeAllocation) + { + _db.TaskAllocations.Update(employeeAllocation); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/UnitOfWork.cs b/Marco.Pms.DataAccess/Repository/UnitOfWork.cs new file mode 100644 index 0000000..bac22da --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/UnitOfWork.cs @@ -0,0 +1,64 @@ +using BulkyBook.DataAccess.Repository; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; + +namespace Marco.Pms.DataAccess.Repository +{ + public class UnitOfWork : IUnitOfWork + { + private readonly ApplicationDbContext _db; + + public IApplicationUserRepository ApplicationUser { get; private set; } + + public IEmployeeRepository Employee { get; private set; } + public ITaskAllocationRepository EmployeeAllocation { get; private set; } + + public IProjectRepository Project { get; private set; } + public IProjectAllocationRepository ProjectAllocation { get; private set; } + + public IBuildingRepository Building { get; private set; } + public IFloorRepository Floor { get; private set; } + public IAttendenceRepository Attendence { get; private set; } + + public IWorkAreaRepository WorkArea { get; private set; } + + public IWorkItemRepository WorkItem { get; private set; } + + public IWorkItemMappingReposiotry WorkItemMapping { get; private set; } + + public IStatusRepository StatusMaster { get; private set; } + public IActivityMasterRepository ActivityMaster { get; private set; } + public IApplicationRolesRepository EmployeeRoles { get; private set; } + public IFeatureRepository Features { get; private set; } + + + public UnitOfWork(ApplicationDbContext db) + { + _db = db; + Employee = new EmployeeRepository(_db); + Project = new ProjectRepository(_db); + ProjectAllocation = new ProjectAllocationRepository(_db); + + Building = new BuildingRepository(_db); + Floor = new FloorRepository(_db); + WorkArea = new WorkAreaRepository(_db); + WorkItem = new WorkItemRepository(_db); + WorkItemMapping = new WorkItemMappingReporitury(_db); + + ApplicationUser = new ApplicationUserRepository(_db); + Attendence = new AttendenceRepository(_db); + EmployeeAllocation = new TaskAllocationRepository(_db); + + StatusMaster = new StatusRepository(_db); + ActivityMaster = new ActivityMasterRepository(_db); + EmployeeRoles = new ApplicationRolesRepository(_db); + Features = new FeaturesRepository(_db); + + } + + public void Save() + { + _db.SaveChanges(); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/WorkAreaRepository.cs b/Marco.Pms.DataAccess/Repository/WorkAreaRepository.cs new file mode 100644 index 0000000..0bdeb25 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/WorkAreaRepository.cs @@ -0,0 +1,22 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Projects; + +namespace BulkyBook.DataAccess.Repository +{ + public class WorkAreaRepository : Repository, IWorkAreaRepository + { + private readonly ApplicationDbContext _db; + public WorkAreaRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(WorkArea workArea) + { + _db.WorkAreas.Update(workArea); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/WorkItemMappingReporitury.cs b/Marco.Pms.DataAccess/Repository/WorkItemMappingReporitury.cs new file mode 100644 index 0000000..f70914e --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/WorkItemMappingReporitury.cs @@ -0,0 +1,22 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Activities; + +namespace BulkyBook.DataAccess.Repository +{ + public class WorkItemMappingReporitury : Repository, IWorkItemMappingReposiotry + { + private readonly ApplicationDbContext _db; + public WorkItemMappingReporitury(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(WorkItemMapping workItem) + { + _db.WorkItemMapping.Update(workItem); + } + } +} diff --git a/Marco.Pms.DataAccess/Repository/WorkItemRepository.cs b/Marco.Pms.DataAccess/Repository/WorkItemRepository.cs new file mode 100644 index 0000000..065ed89 --- /dev/null +++ b/Marco.Pms.DataAccess/Repository/WorkItemRepository.cs @@ -0,0 +1,22 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Activities; + +namespace BulkyBook.DataAccess.Repository +{ + public class WorkItemRepository : Repository, IWorkItemRepository + { + private readonly ApplicationDbContext _db; + public WorkItemRepository(ApplicationDbContext db) : base(db) + { + _db = db; + } + + + public void Update(WorkItem workItem) + { + _db.WorkItems.Update(workItem); + } + } +} diff --git a/Marco.Pms.Model/Activities/TaskAllocation.cs b/Marco.Pms.Model/Activities/TaskAllocation.cs new file mode 100644 index 0000000..43e5d65 --- /dev/null +++ b/Marco.Pms.Model/Activities/TaskAllocation.cs @@ -0,0 +1,52 @@ +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using MarcoBMS.Utility; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + + +namespace Marco.Pms.Model.Activities +{ + public class TaskAllocation + { + public int Id { get; set; } + public int EmployeeId { get; set; } + [ForeignKey("EmployeeId")] + [ValidateNever] + public Employee Employee { get; set; } + public EMP_ROLES EmployeeRole { get; set; } + + public int ProjectId { get; set; } + [ForeignKey("ProjectId")] + [ValidateNever] + public Project Project { get; set; } + + public int BuildingId { get; set; } + + [ForeignKey("BuildingId")] + [ValidateNever] + public Building Building { get; set; } + + public DateTime AllocationDate { get; set; } + public DateTime ReAllocationDate { get; set; } + + public int WorkAreaId { get; set; } + + [ForeignKey("WorkAreaId")] + [ValidateNever] + public WorkArea WorkArea { get; set; } + + public List AllotedTask { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + + + } +} diff --git a/Marco.Pms.Model/Activities/WorkItem.cs b/Marco.Pms.Model/Activities/WorkItem.cs new file mode 100644 index 0000000..8c5738c --- /dev/null +++ b/Marco.Pms.Model/Activities/WorkItem.cs @@ -0,0 +1,35 @@ +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Activities +{ + public class WorkItem + { + public int Id { get; set; } + public int ActivityId { get; set; } + + public int WorkAreaId { get; set; } + [ForeignKey("WorkAreaId")] + [ValidateNever] + public WorkArea WorkArea { get; set; } + + + [ForeignKey("ActivityId")] + [ValidateNever] + public ActivityMaster ActivityMaster { get; set; } + + public int PlannedWork { get; set; } + public int CompletedWork { get; set; } + public DateTime TaskDate { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Activities/WorkItemMapping.cs b/Marco.Pms.Model/Activities/WorkItemMapping.cs new file mode 100644 index 0000000..8cee2eb --- /dev/null +++ b/Marco.Pms.Model/Activities/WorkItemMapping.cs @@ -0,0 +1,29 @@ +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Activities +{ + public class WorkItemMapping + { + public int Id { get; set; } + public int WorkAreaId { get; set; } + [ForeignKey("WorkAreaId")] + [ValidateNever] + public WorkArea WorkArea { get; set; } + public int WorkItemId { get; set; } + [ForeignKey("WorkItemId")] + [ValidateNever] + public WorkItem WorkItem { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + + } +} diff --git a/Marco.Pms.Model/AttendanceModule/Attendance.cs b/Marco.Pms.Model/AttendanceModule/Attendance.cs new file mode 100644 index 0000000..d944803 --- /dev/null +++ b/Marco.Pms.Model/AttendanceModule/Attendance.cs @@ -0,0 +1,40 @@ +using Marco.Pms.Model.Dtos.Attendance; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using Microsoft.Extensions.Logging; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.AttendanceModule +{ + public class Attendance + { + public int Id { get; set; } + public string Comment { get; set; } = string.Empty; + public int EmployeeID { get; set; } + + + public DateTime Date { get; set; } + public int ProjectID { get; set; } + + public DateTime AttendanceDate { get; set; } + public DateTime? InTime { get; set; } + public DateTime? OutTime { get; set; } + public bool IsApproved { get; set; } + public ATTENDANCE_MARK_TYPE Activity { get; set; } + + public int? ApprovedBy { get; set; } + [ForeignKey("EmployeeID")] + [ValidateNever] + public Employee Approver { get; set; } + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + + } +} diff --git a/Marco.Pms.Model/AttendanceModule/AttendanceLog.cs b/Marco.Pms.Model/AttendanceModule/AttendanceLog.cs new file mode 100644 index 0000000..6acf3f1 --- /dev/null +++ b/Marco.Pms.Model/AttendanceModule/AttendanceLog.cs @@ -0,0 +1,51 @@ +using Marco.Pms.Model.Dtos.Attendance; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + + +namespace Marco.Pms.Model.AttendanceModule +{ + public class AttendanceLog + { + public int Id { get; set; } + public string Comment { get; set; } = string.Empty; + public int AttendanceId { get; set; } + [ForeignKey("AttendanceId")] + [ValidateNever] + public Attendance? Attendance { get; set; } + + public int EmployeeID { get; set; } + [ForeignKey("EmployeeID")] + [ValidateNever] + public Employee? Employee { get; set; } + + public DateTime? ActivityTime { get; set; } + + /// + /// CheckIn, CheckOut, RequestRegularize, Regularize, Reject + /// + public ATTENDANCE_MARK_TYPE Activity { get; set; } + + + public byte[]? Photo { get; set; } // To store the captured photo + public string? Latitude { get; set; } + public string? Longitude { get; set; } + + public DateTime UpdatedOn { get; set; } + + public int? UpdatedBy { get; set; } + [ForeignKey("UpdatedBy")] + [ValidateNever] + public Employee? UpdatedByEmployee { get; set; } + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Authentication/JwtSettings.cs b/Marco.Pms.Model/Authentication/JwtSettings.cs new file mode 100644 index 0000000..8e303ee --- /dev/null +++ b/Marco.Pms.Model/Authentication/JwtSettings.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Authentication +{ + public class JwtSettings + { + public string Key { get; set; } + public string Issuer { get; set; } + public string Audience { get; set; } + public int ExpiresInMinutes { get; set; } + public int RefreshTokenExpiresInDays { get; set; } + } +} diff --git a/Marco.Pms.Model/Authentication/RefreshToken.cs b/Marco.Pms.Model/Authentication/RefreshToken.cs new file mode 100644 index 0000000..345a44b --- /dev/null +++ b/Marco.Pms.Model/Authentication/RefreshToken.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Identity; + +namespace Marco.Pms.Model.Authentication +{ + public class RefreshToken + { + public int Id { get; set; } + public string Token { get; set; } + public string UserId { get; set; } + public DateTime ExpiryDate { get; set; } + public bool IsRevoked { get; set; } + public bool IsUsed { get; set; } + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public DateTime? RevokedAt { get; set; } + + + // Relationship with the User + public IdentityUser User { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Attendance/RecordAttendanceDot.cs b/Marco.Pms.Model/Dtos/Attendance/RecordAttendanceDot.cs new file mode 100644 index 0000000..2cfac87 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Attendance/RecordAttendanceDot.cs @@ -0,0 +1,28 @@ +using Marco.Pms.Model.Utilities; + +namespace Marco.Pms.Model.Dtos.Attendance +{ + public class RecordAttendanceDot + { + public int? Id { get; set; } + public string Comment { get; set; } + public int EmployeeID { get; set; } + public int ProjectID { get; set; } + + public DateTime Date { get; set; } + + public string? MarkTime { get; set; } + public string Latitude { get; set; } + public string Longitude { get; set; } + + + public ATTENDANCE_MARK_TYPE Action { get; set; } + + public List? Image { get; set; } + } + + public enum ATTENDANCE_MARK_TYPE + { + CHECK_IN = 0, CHECK_OUT = 1, REQUEST_REGULARIZE = 2, REQUEST_DELETE = 3, REGULARIZE = 4, REGULARIZE_REJECT = 5 + } +} diff --git a/Marco.Pms.Model/Dtos/Employees/ApplicationUserDto.cs b/Marco.Pms.Model/Dtos/Employees/ApplicationUserDto.cs new file mode 100644 index 0000000..b6bdae8 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Employees/ApplicationUserDto.cs @@ -0,0 +1,38 @@ +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Http; + +namespace Marco.Pms.Model.Dtos.Employees +{ + public class ApplicationUserDto + { + public ApplicationUserDto() { } + public int? Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string? MiddleName { get; set; } + public string? Email { get; set; } + + public string Gender { get; set; } + public DateTime? BirthDate { get; set; } + public DateTime? JoiningDate { get; set; } + + public string PeramnentAddress { get; set; } + public string CurrentAddress { get; set; } + public string PhoneNumber { get; set; } + + public string EmergencyPhoneNumber { get; set; } + + public string? AadharNumber { get; set; } + + public string? PanNumber { get; set; } + + public IFormFile? Photo { get; set; } // To store the captured photo + public List Documents { get; set; } + public string? ApplicationUserId { get; set; } + + public Guid RoleId { get; set; } + + public int TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Dtos/Employees/AttendanceDto.cs b/Marco.Pms.Model/Dtos/Employees/AttendanceDto.cs new file mode 100644 index 0000000..1565527 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Employees/AttendanceDto.cs @@ -0,0 +1,26 @@ +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Employees +{ + public class AttendanceDto + { + public string Comment { get; set; } + public int EmployeeID { get; set; } + public DateTime? InTime { get; set; } + public DateTime? OutTime { get; set; } + public int ShiftId { get; set; } + public decimal? Latitude { get; set; } + public decimal? Longitude { get; set; } + public bool IsApproved { get; set; } + } + +} diff --git a/Marco.Pms.Model/Dtos/Employees/CreateUserDto.cs b/Marco.Pms.Model/Dtos/Employees/CreateUserDto.cs new file mode 100644 index 0000000..5f295c0 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Employees/CreateUserDto.cs @@ -0,0 +1,57 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Employees +{ + public class CreateUserDto + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string? MiddleName { get; set; } + public string? Email { get; set; } + + public string Gender { get; set; } + public string? BirthDate { get; set; } + public string JoiningDate { get; set; } + + public string? PeramnentAddress { get; set; } + public string? CurrentAddress { get; set; } + public string PhoneNumber { get; set; } + + public string EmergencyPhoneNumber { get; set; } + public string EmergencyContactPerson { get; set; } + + public string? AadharNumber { get; set; } + + public string? PanNumber { get; set; } + + public IFormFile? Photo { get; set; } // To store the captured photo + public List? Documents { get; set; } + + public string JobRoleId { get; set; } + + // public int TenantId { get; set; } + } + public class CreateQuickUserDto + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + + public string Gender { get; set; } + + public string? CurrentAddress { get; set; } + public string PhoneNumber { get; set; } + + public string EmergencyPhoneNumber { get; set; } + public string EmergencyContactPerson { get; set; } + + public string JobRoleId { get; set; } + } + +} diff --git a/Marco.Pms.Model/Dtos/Employees/EmployeeRoleDot.cs b/Marco.Pms.Model/Dtos/Employees/EmployeeRoleDot.cs new file mode 100644 index 0000000..48c1873 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Employees/EmployeeRoleDot.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Dtos.Employees +{ + public class EmployeeRoleDot + { + + public string Id { get; set; } = string.Empty; + public int EmployeeId { get; set; } + public Guid RoleId { get; set; } + public bool IsEnabled { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/ForgotPasswordDto.cs b/Marco.Pms.Model/Dtos/ForgotPasswordDto.cs new file mode 100644 index 0000000..a379ae7 --- /dev/null +++ b/Marco.Pms.Model/Dtos/ForgotPasswordDto.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos +{ + public class ForgotPasswordDto + { + [Required] + [EmailAddress] + public string Email { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/LoginDto.cs b/Marco.Pms.Model/Dtos/LoginDto.cs new file mode 100644 index 0000000..bf6f8cc --- /dev/null +++ b/Marco.Pms.Model/Dtos/LoginDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos +{ + public class LoginDto + { + public string Username { get; set; } + public string Password { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/LogoutDto.cs b/Marco.Pms.Model/Dtos/LogoutDto.cs new file mode 100644 index 0000000..263424d --- /dev/null +++ b/Marco.Pms.Model/Dtos/LogoutDto.cs @@ -0,0 +1,7 @@ + +namespace Marco.Pms.Model.Dtos +{ + public class LogoutDto + { public string RefreshToken { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/BuildingDot.cs b/Marco.Pms.Model/Dtos/Project/BuildingDot.cs new file mode 100644 index 0000000..3fec06b --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/BuildingDot.cs @@ -0,0 +1,27 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class BuildingDot + { + [Key] + public int Id { get; set; } + [Required] + [DisplayName("Building Name")] + public string Name { get; set; } + public string? Description { get; set; } + public int ProjectId { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/BuildingVM.cs b/Marco.Pms.Model/Dtos/Project/BuildingVM.cs new file mode 100644 index 0000000..8323564 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/BuildingVM.cs @@ -0,0 +1,14 @@ + + +namespace Marco.Pms.Model.Dtos.Project +{ + public class BuildingVM + { + public int Id { get; set; } + public string Name { get; set; } + public string? Description { get; set; } + + public List Floors { get; set; } + + } +} diff --git a/Marco.Pms.Model/Dtos/Project/CreateProjectDto.cs b/Marco.Pms.Model/Dtos/Project/CreateProjectDto.cs new file mode 100644 index 0000000..41e7f63 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/CreateProjectDto.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class CreateProjectDto + { + //public int Id { get; set; } + [Required(ErrorMessage = "Project Name is required!")] + [DisplayName("Project Name")] + public string Name { get; set; } + + [DisplayName("Project Address")] + [Required(ErrorMessage = "Project Address is required!")] + public string ProjectAddress { get; set; } + + + [DisplayName("Contact Person")] + public string ContactPerson { get; set; } + + + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + + [DisplayName("Project Status")] + [Required(ErrorMessage = "Project Status is required!")] + public int ProjectStatusId { get; set; } + + public int TenantId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/FloorDot.cs b/Marco.Pms.Model/Dtos/Project/FloorDot.cs new file mode 100644 index 0000000..d437e78 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/FloorDot.cs @@ -0,0 +1,30 @@ +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class FloorDot + { + public int Id { get; set; } + + [Required] + [DisplayName("Floor Name")] + public string FloorName { get; set; } + + + public int BuildingId { get; set; } + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/FloorsVM.cs b/Marco.Pms.Model/Dtos/Project/FloorsVM.cs new file mode 100644 index 0000000..7532493 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/FloorsVM.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class FloorsVM + { + public int Id { get; set; } + + [Required] + [DisplayName("Floor Name")] + public string FloorName { get; set; } + + public List WorkAreas { get; set; } + + } +} diff --git a/Marco.Pms.Model/Dtos/Project/InfraDot.cs b/Marco.Pms.Model/Dtos/Project/InfraDot.cs new file mode 100644 index 0000000..a37fb6b --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/InfraDot.cs @@ -0,0 +1,16 @@ +using Marco.Pms.Model.Projects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class InfraDot + { + public BuildingDot? Building { get; set; } + public FloorDot? Floor { get; set; } + public WorkAreaDot? WorkArea { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/ProjectAllocationDot.cs b/Marco.Pms.Model/Dtos/Project/ProjectAllocationDot.cs new file mode 100644 index 0000000..08690ea --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/ProjectAllocationDot.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.Dtos.Project +{ + public class ProjectAllocationDot + { + public int EmpID { get; set; } + public Guid RoleID { get; set; } + public int ProjectId { get; set; } + + public bool Status { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/ProjectDto.cs b/Marco.Pms.Model/Dtos/Project/ProjectDto.cs new file mode 100644 index 0000000..8bdaaf3 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/ProjectDto.cs @@ -0,0 +1,41 @@ +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class ProjectDto + { + public int Id { get; set; } + [Required(ErrorMessage = "Project Name is required!")] + [DisplayName("Project Name")] + public string Name { get; set; } + + [DisplayName("Project Address")] + [Required(ErrorMessage = "Project Address is required!")] + public string ProjectAddress { get; set; } + + + [DisplayName("Contact Person")] + public string ContactPerson { get; set; } + + + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + + [DisplayName("Project Status")] + [Required(ErrorMessage = "Project Status is required!")] + public int ProjectStatusId { get; set; } + public int TenantId { get; set; } + + + } +} diff --git a/Marco.Pms.Model/Dtos/Project/ProjectVM.cs b/Marco.Pms.Model/Dtos/Project/ProjectVM.cs new file mode 100644 index 0000000..aef5d1f --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/ProjectVM.cs @@ -0,0 +1,15 @@ +using Marco.Pms.Model.Projects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class ProjectVM : ProjectDto + { + public List Buildings { get; set; } + + } +} diff --git a/Marco.Pms.Model/Dtos/Project/UpdateProjectDto.cs b/Marco.Pms.Model/Dtos/Project/UpdateProjectDto.cs new file mode 100644 index 0000000..c155669 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/UpdateProjectDto.cs @@ -0,0 +1,31 @@ +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class UpdateProjectDto + { + public int Id { get; set; } + [Required(ErrorMessage = "Project Name is required!")] + [DisplayName("Project Name")] + public string Name { get; set; } + + [DisplayName("Project Address")] + [Required(ErrorMessage = "Project Address is required!")] + public string ProjectAddress { get; set; } + + + [DisplayName("Contact Person")] + public string ContactPerson { get; set; } + + + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + + [DisplayName("Project Status")] + [Required(ErrorMessage = "Project Status is required!")] + public int ProjectStatusId { get; set; } + + public int TenantId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/WorkAreaDot.cs b/Marco.Pms.Model/Dtos/Project/WorkAreaDot.cs new file mode 100644 index 0000000..c02ac52 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/WorkAreaDot.cs @@ -0,0 +1,30 @@ +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Projects; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class WorkAreaDot + { + [Key] + public int Id { get; set; } + + [Required] + [DisplayName("Area Name")] + public string AreaName { get; set; } + + public int FloorId { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + } +} diff --git a/Marco.Pms.Model/Dtos/Project/WorkAreaVM.cs b/Marco.Pms.Model/Dtos/Project/WorkAreaVM.cs new file mode 100644 index 0000000..b40efe2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/WorkAreaVM.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class WorkAreaVM + { + public int Id { get; set; } + + [Required] + [DisplayName("Area Name")] + public string AreaName { get; set; } + + public List WorkItems { get; set; } + + } +} diff --git a/Marco.Pms.Model/Dtos/Project/WorkItemDot.cs b/Marco.Pms.Model/Dtos/Project/WorkItemDot.cs new file mode 100644 index 0000000..831b536 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/WorkItemDot.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class WorkItemDot + { + [Key] + public int Id { get; set; } + public int WorkAreaID { get; set; } + + public int ActivityID { get; set; } + public int PlannedWork { get; set; } + public int CompletedWork { get; set; } + public int TenantId { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Project/WorkItemVM.cs b/Marco.Pms.Model/Dtos/Project/WorkItemVM.cs new file mode 100644 index 0000000..ae3c7fc --- /dev/null +++ b/Marco.Pms.Model/Dtos/Project/WorkItemVM.cs @@ -0,0 +1,10 @@ +using Marco.Pms.Model.Activities; + +namespace Marco.Pms.Model.Dtos.Project +{ + public class WorkItemVM + { + public int WorkItemId { get; set; } + public WorkItem WorkItem { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/RefreshTokenDto.cs b/Marco.Pms.Model/Dtos/RefreshTokenDto.cs new file mode 100644 index 0000000..7eaecc2 --- /dev/null +++ b/Marco.Pms.Model/Dtos/RefreshTokenDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos +{ + public class RefreshTokenDto + { + public string Token { get; set; } + public string RefreshToken { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/RegisterDto.cs b/Marco.Pms.Model/Dtos/RegisterDto.cs new file mode 100644 index 0000000..0f2c7ea --- /dev/null +++ b/Marco.Pms.Model/Dtos/RegisterDto.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos +{ + public class RegisterDto + { + [Required] + public string Username { get; set; } + + [Required] + [EmailAddress] + public string Email { get; set; } + + [Required] + [MinLength(6)] + public string Password { get; set; } + + [Compare("Password", ErrorMessage = "Passwords do not match.")] + public string ConfirmPassword { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/ResetPasswordDto.cs b/Marco.Pms.Model/Dtos/ResetPasswordDto.cs new file mode 100644 index 0000000..5ad8573 --- /dev/null +++ b/Marco.Pms.Model/Dtos/ResetPasswordDto.cs @@ -0,0 +1,21 @@ +using System.ComponentModel.DataAnnotations; + +namespace Marco.Pms.Model.Dtos +{ + public class ResetPasswordDto + { + [Required] + [EmailAddress] + public string Email { get; set; } + + [Required] + public string Token { get; set; } + + [Required] + [MinLength(6)] + public string NewPassword { get; set; } + + [Compare("NewPassword", ErrorMessage = "Passwords do not match.")] + public string ConfirmPassword { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Roles/CreateApplicationRoleDto.cs b/Marco.Pms.Model/Dtos/Roles/CreateApplicationRoleDto.cs new file mode 100644 index 0000000..6d72b65 --- /dev/null +++ b/Marco.Pms.Model/Dtos/Roles/CreateApplicationRoleDto.cs @@ -0,0 +1,23 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Dtos.Roles +{ + public class CreateApplicationRoleDto + { + [Required(ErrorMessage = "Role Name is required!")] + [DisplayName("Name")] + + public string Role { get; set; } + + [Required(ErrorMessage = "Role Description is required!")] + [DisplayName("Description")] + + public string Description { get; set; } + + public List FeaturesPermission { get; set; } // Features assigned to this role + } +} diff --git a/Marco.Pms.Model/Dtos/Roles/CreateJobRoleDto.cs b/Marco.Pms.Model/Dtos/Roles/CreateJobRoleDto.cs new file mode 100644 index 0000000..ed6183d --- /dev/null +++ b/Marco.Pms.Model/Dtos/Roles/CreateJobRoleDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Roles +{ + public class CreateJobRoleDto + { + public string Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Roles/UpdateApplicationRoleDto.cs b/Marco.Pms.Model/Dtos/Roles/UpdateApplicationRoleDto.cs new file mode 100644 index 0000000..938399b --- /dev/null +++ b/Marco.Pms.Model/Dtos/Roles/UpdateApplicationRoleDto.cs @@ -0,0 +1,30 @@ +using Marco.Pms.Model.Entitlements; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace Marco.Pms.Model.Dtos.Roles +{ + public class UpdateApplicationRoleDto + { + public Guid Id { get; set; } + + [Required(ErrorMessage = "Role Name is required!")] + [DisplayName("Name")] + + public string Role { get; set; } + + [Required(ErrorMessage = "Role Description is required!")] + [DisplayName("Description")] + + public string Description { get; set; } + + + public List FeaturesPermission { get; set; } // Features assigned to this role + } + + public class FeaturesPermissionDto + { + public Guid Id { get; set; } + public bool IsEnabled { get; set; } + } +} diff --git a/Marco.Pms.Model/Dtos/Roles/UpdateJobRoleDto.cs b/Marco.Pms.Model/Dtos/Roles/UpdateJobRoleDto.cs new file mode 100644 index 0000000..ef017fe --- /dev/null +++ b/Marco.Pms.Model/Dtos/Roles/UpdateJobRoleDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Dtos.Roles +{ + public class UpdateJobRoleDto + { + public int Id { get; set; } + public string Name { get; set; } + public string? Description { get; set; } + } +} diff --git a/Marco.Pms.Model/Employees/Employee.cs b/Marco.Pms.Model/Employees/Employee.cs new file mode 100644 index 0000000..303c995 --- /dev/null +++ b/Marco.Pms.Model/Employees/Employee.cs @@ -0,0 +1,52 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Employees +{ + public class Employee + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string? MiddleName { get; set; } + public string? Email { get; set; } + + public string Gender { get; set; } + public DateTime? BirthDate { get; set; } + public string PeramnentAddress { get; set; } + public string CurrentAddress { get; set; } + public string PhoneNumber { get; set; } + + public string EmergencyPhoneNumber { get; set; } + + public string? AadharNumber { get; set; } + + public string? PanNumber { get; set; } + + public byte[]? Photo { get; set; } // To store the captured photo + + public string? ApplicationUserId { get; set; } + [ForeignKey("ApplicationUserId")] + [ValidateNever] + public ApplicationUser? ApplicationUser { get; set; } + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + + public Guid RoleId { get; set; } + //[ForeignKey(nameof(RoleId))] + //public EmployeeRole EmployeeRole { get; set; } + + public int? JobRoleId { get; set; } + [ForeignKey("JobRoleId")] + [ValidateNever] + public JobRole? JobRole { get; set; } + + + } +} diff --git a/Marco.Pms.Model/Employees/EmployeeDetails.cs b/Marco.Pms.Model/Employees/EmployeeDetails.cs new file mode 100644 index 0000000..5f9b505 --- /dev/null +++ b/Marco.Pms.Model/Employees/EmployeeDetails.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Employees +{ + public class EmployeeDetails : Employee + { + public int ProjectId { get; set; } + } +} diff --git a/Marco.Pms.Model/Employees/EmployeeDocument.cs b/Marco.Pms.Model/Employees/EmployeeDocument.cs new file mode 100644 index 0000000..8092000 --- /dev/null +++ b/Marco.Pms.Model/Employees/EmployeeDocument.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Employees +{ + public class EmployeeDocument + { + public Guid Id { get; set; } // Unique identifier for the document + public string FileName { get; set; } // Original file name + public string FilePath { get; set; } // Path to the stored file + public string FileType { get; set; } // Type of the document (e.g., PDF, JPG) + public long FileSize { get; set; } // File size in bytes + public DateTime UploadedAt { get; set; } // Timestamp of upload + + public Guid EmployeeId { get; set; } // Foreign key to Employee + [ValidateNever] + [ForeignKey(nameof(EmployeeId))] + public Employee Employee { get; set; } // Navigation property to Employee + } + + +} diff --git a/Marco.Pms.Model/Employees/WorkShift.cs b/Marco.Pms.Model/Employees/WorkShift.cs new file mode 100644 index 0000000..7f25949 --- /dev/null +++ b/Marco.Pms.Model/Employees/WorkShift.cs @@ -0,0 +1,24 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Employees +{ + public class WorkShift + { + public int Id { get; set; } + [DisplayName("Shift Name")] + public string Name { get; set; } + public TimeOnly StartTime { get; set; } + public TimeOnly EndTime { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + + } +} diff --git a/Marco.Pms.Model/Entitlements/ActivityMaster.cs b/Marco.Pms.Model/Entitlements/ActivityMaster.cs new file mode 100644 index 0000000..95ea6ad --- /dev/null +++ b/Marco.Pms.Model/Entitlements/ActivityMaster.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Entitlements +{ + public class ActivityMaster + { + public int Id { get; set; } + public string ActivityName { get; set; } + + public string UnitOfMeasurement { get; set; } + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Entitlements/ApplicationRole.cs b/Marco.Pms.Model/Entitlements/ApplicationRole.cs new file mode 100644 index 0000000..512e99b --- /dev/null +++ b/Marco.Pms.Model/Entitlements/ApplicationRole.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Entitlements +{ + public class ApplicationRole + { + public Guid Id { get; set; } + public string Role { get; set; } + public string Description { get; set; } + + public int TenantId { get; set; } + + } + + +} diff --git a/Marco.Pms.Model/Entitlements/ApplicationUser.cs b/Marco.Pms.Model/Entitlements/ApplicationUser.cs new file mode 100644 index 0000000..ef7770a --- /dev/null +++ b/Marco.Pms.Model/Entitlements/ApplicationUser.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using Microsoft.Extensions.Logging; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Entitlements +{ + public class ApplicationUser : IdentityUser + { + [Required] + public string Role { get; set; } // e.g. Admin, SiteManager, SkilledWorker, etc. + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + public bool? IsRootUser { get; set; } + + //[ValidateNever] + //[ForeignKey(nameof(TenantId))] + //public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Entitlements/Client.cs b/Marco.Pms.Model/Entitlements/Client.cs new file mode 100644 index 0000000..1ce97dd --- /dev/null +++ b/Marco.Pms.Model/Entitlements/Client.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Entitlements +{ + public class Tenant + { + public int Id { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public string DomainName { get; set; } + public string ContactName { get; set; } + public string ContactNumber { get; set; } + public DateTime OnBoardingDate { get; set; } + } +} diff --git a/Marco.Pms.Model/Entitlements/EmployeeRoleMapping.cs b/Marco.Pms.Model/Entitlements/EmployeeRoleMapping.cs new file mode 100644 index 0000000..5e92dc9 --- /dev/null +++ b/Marco.Pms.Model/Entitlements/EmployeeRoleMapping.cs @@ -0,0 +1,31 @@ +using Marco.Pms.Model.Employees; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Entitlements +{ + public class EmployeeRoleMapping + { + public Guid Id { get; set; } + public int EmployeeId { get; set; } + [ValidateNever] + [ForeignKey(nameof(EmployeeId))] + public Employee Employee { get; set; } // Navigation property to Employee + + public Guid RoleId { get; set; } + [ValidateNever] + [ForeignKey(nameof(RoleId))] + public ApplicationRole Role { get; set; } + + + public bool IsEnabled { get; set; } + public int TenantId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + + } +} + + diff --git a/Marco.Pms.Model/Entitlements/Feature.cs b/Marco.Pms.Model/Entitlements/Feature.cs new file mode 100644 index 0000000..dc844df --- /dev/null +++ b/Marco.Pms.Model/Entitlements/Feature.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Entitlements +{ + public class Feature + { + public Guid Id { get; set; } // Unique identifier for the feature + public int ModuleId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ModuleId))] + public Module Module { get; set; } + public string Name { get; set; } // Feature name + public string Description { get; set; } // Feature description + public bool IsActive { get; set; } + + public ICollection FeaturePermissions { get; set; } // Features assigned to this role + } + +} diff --git a/Marco.Pms.Model/Entitlements/FeaturePermission.cs b/Marco.Pms.Model/Entitlements/FeaturePermission.cs new file mode 100644 index 0000000..830807a --- /dev/null +++ b/Marco.Pms.Model/Entitlements/FeaturePermission.cs @@ -0,0 +1,29 @@ +using Marco.Pms.Model.Projects; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Entitlements +{ + public class FeaturePermission + { + public Guid Id { get; set; } // Unique identifier for the permission + + public Guid FeatureId { get; set; } // Foreign key to Feature + [ForeignKey("FeatureId")] + [ValidateNever] + public Feature Feature { get; set; } + + public string Name { get; set; } // Feature name + public string Description { get; set; } // Feature description + + public bool IsEnabled { get; set; } // Whether the feature is enabled for this role + + } + +} diff --git a/Marco.Pms.Model/Entitlements/JobRole.cs b/Marco.Pms.Model/Entitlements/JobRole.cs new file mode 100644 index 0000000..3557525 --- /dev/null +++ b/Marco.Pms.Model/Entitlements/JobRole.cs @@ -0,0 +1,17 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Entitlements +{ + public class JobRole + { + public int Id { get; set; } + public string Name { get; set; } + public string? Description { get; set; } + public int TenantId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + + } +} diff --git a/Marco.Pms.Model/Entitlements/Module.cs b/Marco.Pms.Model/Entitlements/Module.cs new file mode 100644 index 0000000..09c92b4 --- /dev/null +++ b/Marco.Pms.Model/Entitlements/Module.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; + +namespace Marco.Pms.Model.Entitlements +{ + public class Module + { + + public Module() + { + Key = Guid.NewGuid().ToString(); + } + [Key] + public int Id { get; set; } + + [Required] + public string Name { get; set; } + + public string Description { get; set; } + + + + public string Key { get; set; } + + } +} diff --git a/Marco.Pms.Model/Entitlements/RolePermissionMappings.cs b/Marco.Pms.Model/Entitlements/RolePermissionMappings.cs new file mode 100644 index 0000000..1fc4e91 --- /dev/null +++ b/Marco.Pms.Model/Entitlements/RolePermissionMappings.cs @@ -0,0 +1,8 @@ +namespace Marco.Pms.Model.Entitlements +{ + public class RolePermissionMappings + { + public Guid ApplicationRoleId { get; set; } + public Guid FeaturePermissionId { get; set; } + } +} diff --git a/Marco.Pms.Model/Entitlements/StatusMaster.cs b/Marco.Pms.Model/Entitlements/StatusMaster.cs new file mode 100644 index 0000000..845f701 --- /dev/null +++ b/Marco.Pms.Model/Entitlements/StatusMaster.cs @@ -0,0 +1,24 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Entitlements +{ + public class StatusMaster + { + public int Id { get; set; } + public string Status { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Mapper/ApplicationRoleMapper.cs b/Marco.Pms.Model/Mapper/ApplicationRoleMapper.cs new file mode 100644 index 0000000..8468e3d --- /dev/null +++ b/Marco.Pms.Model/Mapper/ApplicationRoleMapper.cs @@ -0,0 +1,76 @@ +using Marco.Pms.Model.Dtos.Roles; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.ViewModels; + +namespace Marco.Pms.Model.Mapper +{ + public static class ApplicationRoleMapper + { + public static ApplicationRolesVM ToRoleVMFromApplicationRole(this ApplicationRole model) + { + return new ApplicationRolesVM + { + Id = model.Id, + Role = model.Role, + Description = model.Description, + //FeaturePermission = model.FeaturePermissions + }; + } + public static ApplicationRole ToApplicationRoleFromCreateDto(this CreateApplicationRoleDto model, int TenantId) + { + return new ApplicationRole + { + Id = new Guid(), + Role = model.Role, + Description = model.Description, + //FeaturePermissions = model.FeaturesPermission, + TenantId = TenantId, + }; + } + + public static ApplicationRole ToApplicationRoleFromUpdateDto(this UpdateApplicationRoleDto model, int TenantId) + { + return new ApplicationRole + { + Id = model.Id, + Role = model.Role, + Description = model.Description, + //FeaturePermissions = model.FeaturePermission, + TenantId = TenantId, + }; + } + + public static JobRole ToJobRoleFromCreateJobRoleDot(this CreateJobRoleDto model, int TenantId) + { + return new JobRole + { + + Name = model.Name, + Description = model.Description, + TenantId = TenantId + }; + } + + public static JobRole ToJobRoleFromUpdateJobRoleDot(this UpdateJobRoleDto model, int TenantId) + { + return new JobRole + { + Id = model.Id, + Name = model.Name, + Description = model.Description, + TenantId = TenantId + }; + } + + public static JobRoleVM ToJobRoleVMFromJobRole(this JobRole model) + { + return new JobRoleVM + { + Id = model.Id, + Name = model.Name, + Description = model.Description, + }; + } + + } +} diff --git a/Marco.Pms.Model/Mapper/EmployeeRoleMapper.cs b/Marco.Pms.Model/Mapper/EmployeeRoleMapper.cs new file mode 100644 index 0000000..f4ba30f --- /dev/null +++ b/Marco.Pms.Model/Mapper/EmployeeRoleMapper.cs @@ -0,0 +1,46 @@ +using Marco.Pms.Model.Dtos.Employees; +using Marco.Pms.Model.Dtos.Roles; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.ViewModels; + +namespace Marco.Pms.Model.Mapper +{ + public static class EmployeeRoleMapper + { + //public static EmployeeRolesVM ToRoleVMFromEmployeeRole(this EmployeeRole model) + //{ + // return new EmployeeRolesVM + // { + // Id = model.Id, + // Role = model.Role, + // Description = model.Description, + // Features = model.Features + // }; + //} + public static EmployeeRoleMapping ToEmployeeRoleMappingFromEmployeeRoleDot(this EmployeeRoleDot model, int TenantId) + { + Guid id = (string.IsNullOrEmpty(model.Id ) ?Guid.NewGuid() : new Guid(model.Id)); + return new EmployeeRoleMapping + { + Id = id, + RoleId = model.RoleId, + EmployeeId = model.EmployeeId, + IsEnabled = model.IsEnabled, + TenantId = TenantId + }; + } + + + //public static EmployeeRole ToEmployeeRoleFromUpdateDto(this UpdateApplicationRoleDto model, int TenantId) + //{ + // return new EmployeeRole + // { + // Id = model.Id, + // Role = model.Role, + // Description = model.Description, + // Features = model.Features, + // TenantId = TenantId, + // }; + //} + } +} diff --git a/Marco.Pms.Model/Mapper/FeatureMapper.cs b/Marco.Pms.Model/Mapper/FeatureMapper.cs new file mode 100644 index 0000000..9fc3c1f --- /dev/null +++ b/Marco.Pms.Model/Mapper/FeatureMapper.cs @@ -0,0 +1,44 @@ +using Marco.Pms.Model.Dtos.Roles; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.ViewModels; + +namespace Marco.Pms.Model.Mapper +{ + public static class FeatureMapper + { + public static FeaturePermissionVM ToFeaturePermissionVMFromFeaturePermission(this FeaturePermission model) + { + return new FeaturePermissionVM + { + Id = model.Id, + FeatureId = model.FeatureId, + Description = model.Description, + IsEnabled = model.IsEnabled, + Name = model.Name, + }; + } + //public static EmployeeRole ToEmployeeRoleFromCreateDto(this CreateRoleDto model, int TenantId) + //{ + // return new EmployeeRole + // { + // Id =new Guid(), + // Role = model.Role, + // Description = model.Description, + // Features = model.Features, + // TenantId = TenantId, + // }; + //} + + //public static EmployeeRole ToEmployeeRoleFromUpdateDto(this UpdateRoleDto model, int TenantId) + //{ + // return new EmployeeRole + // { + // Id = model.Id, + // Role = model.Role, + // Description = model.Description, + // Features = model.Features, + // TenantId = TenantId, + // }; + //} + } +} diff --git a/Marco.Pms.Model/Mapper/InfraMapper.cs b/Marco.Pms.Model/Mapper/InfraMapper.cs new file mode 100644 index 0000000..247babd --- /dev/null +++ b/Marco.Pms.Model/Mapper/InfraMapper.cs @@ -0,0 +1,72 @@ +using Marco.Pms.Model.Activities; +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Projects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Mapper +{ + public static class BuildingMapper + { + public static Building ToBuildingFromBuildingDto(this BuildingDot model) + { + return new Building + { + Id = model.Id, + Description = model.Description, + Name = model.Name, + ProjectId = model.ProjectId, + TenantId = model.TenantId, + }; + } + } + + public static class FloorMapper + { + public static Floor ToFloorFromFloorDto(this FloorDot model) + { + return new Floor + { + Id = model.Id, + FloorName = model.FloorName, + BuildingId = model.BuildingId, + TenantId = model.TenantId + }; + } + } + + public static class WorAreaMapper + { + public static WorkArea ToWorkAreaFromWorkAreaDto(this WorkAreaDot model) + { + return new WorkArea + { + Id = model.Id, + AreaName = model.AreaName, + FloorId = model.FloorId, + TenantId = model.TenantId + + }; + } + } + public static class WorkItemMapper + { + public static WorkItem ToWorkItemFromWorkItemDto(this WorkItemDot model) + { + return new WorkItem + { + Id = model.Id, + ActivityId = model.ActivityID, + CompletedWork = model.CompletedWork, + PlannedWork = model.PlannedWork, + TaskDate = DateTime.Now, + TenantId = model.TenantId, + WorkAreaId = model.WorkAreaID + + }; + } + } +} diff --git a/Marco.Pms.Model/Mapper/ProjectMapper.cs b/Marco.Pms.Model/Mapper/ProjectMapper.cs new file mode 100644 index 0000000..f48e026 --- /dev/null +++ b/Marco.Pms.Model/Mapper/ProjectMapper.cs @@ -0,0 +1,52 @@ +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Projects; + +namespace Marco.Pms.Model.Mapper +{ + public static class ProjectMapper + { + public static ProjectDto ToProjectDto(this Project projectModel) + { + return new ProjectDto + { + Id = projectModel.Id, + ContactPerson = projectModel.ContactPerson, + ProjectAddress = projectModel.ProjectAddress, + Name = projectModel.Name, + EndDate = projectModel.EndDate, + StartDate = projectModel.StartDate, + TenantId = projectModel.TenantId, + ProjectStatusId = projectModel.ProjectStatusId + }; + } + + public static Project ToProjectFromCreateProjectDto(this CreateProjectDto projectModel, int TenantId) + { + return new Project + { + ContactPerson = projectModel.ContactPerson, + ProjectAddress = projectModel.ProjectAddress, + Name = projectModel.Name, + EndDate = projectModel.EndDate, + StartDate = projectModel.StartDate, + TenantId = TenantId, + ProjectStatusId = projectModel.ProjectStatusId + }; + } + + + public static ProjectAllocation ToProjectAllocationFromProjectAllocationDto(this ProjectAllocationDot model, int TenantId) + { + return new ProjectAllocation + { + AllocationDate = DateTime.Now, + EmployeeId = model.EmpID, + EmployeeRoleId = model.RoleID, + TenantId = TenantId, + ProjectId = model.ProjectId + }; + } + + + } +} diff --git a/Marco.Pms.Model/Marco.Pms.Model.csproj b/Marco.Pms.Model/Marco.Pms.Model.csproj new file mode 100644 index 0000000..d5927ce --- /dev/null +++ b/Marco.Pms.Model/Marco.Pms.Model.csproj @@ -0,0 +1,19 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + diff --git a/Marco.Pms.Model/Projects/Building.cs b/Marco.Pms.Model/Projects/Building.cs new file mode 100644 index 0000000..283affa --- /dev/null +++ b/Marco.Pms.Model/Projects/Building.cs @@ -0,0 +1,28 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Projects +{ + public class Building + { + [Key] + public int Id { get; set; } + [Required] + [DisplayName("Building Name")] + public string Name { get; set; } + public string? Description { get; set; } + + public int ProjectId { get; set; } + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Projects/Floor.cs b/Marco.Pms.Model/Projects/Floor.cs new file mode 100644 index 0000000..96723c0 --- /dev/null +++ b/Marco.Pms.Model/Projects/Floor.cs @@ -0,0 +1,37 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Marco.Pms.Model.Entitlements; + +namespace Marco.Pms.Model.Projects +{ + public class Floor + { + public int Id { get; set; } + + [Required] + [DisplayName("Floor Name")] + public string FloorName { get; set; } + + + public int BuildingId { get; set; } + + [ForeignKey("BuildingId")] + [ValidateNever] + public Building Building { get; set; } + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Projects/PhotoGallary.cs b/Marco.Pms.Model/Projects/PhotoGallary.cs new file mode 100644 index 0000000..97f44f7 --- /dev/null +++ b/Marco.Pms.Model/Projects/PhotoGallary.cs @@ -0,0 +1,22 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Projects +{ + public class PhotoGallary + { + public int Id { get; set; } + public string Description { get; set; } + public int ProjectId { get; set; } + [ValidateNever] + [ForeignKey(nameof(ProjectId))] + public Project? Project { get; set; } + public string AddedBy { get; set; } + [ValidateNever] + [ForeignKey(nameof(AddedBy))] + public ApplicationUser? ApplicationUser { get; set; } + public DateTime AddedOn { get; set; } + public required string Imagebase64 { get; set; } + } +} diff --git a/Marco.Pms.Model/Projects/Project.cs b/Marco.Pms.Model/Projects/Project.cs new file mode 100644 index 0000000..d040b6c --- /dev/null +++ b/Marco.Pms.Model/Projects/Project.cs @@ -0,0 +1,47 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Projects +{ + public class Project + { + [Key] + public int Id { get; set; } + [Required] + [DisplayName("Project Name")] + public string Name { get; set; } + + [DisplayName("Project Address")] + public string ProjectAddress { get; set; } + + [DisplayName("Contact Person")] + + public string ContactPerson { get; set; } + + public DateTime? StartDate { get; set; } + public DateTime? EndDate { get; set; } + + [DisplayName("Project Status")] + public int ProjectStatusId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(ProjectStatusId))] + public StatusMaster ProjectStatus { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Projects/ProjectAllocation.cs b/Marco.Pms.Model/Projects/ProjectAllocation.cs new file mode 100644 index 0000000..d7ef982 --- /dev/null +++ b/Marco.Pms.Model/Projects/ProjectAllocation.cs @@ -0,0 +1,40 @@ +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Marco.Pms.Model.Projects +{ + public class ProjectAllocation + { + public int Id { get; set; } + public int EmployeeId { get; set; } + [ForeignKey("EmployeeId")] + [ValidateNever] + public Employee Employee { get; set; } + + public Guid? EmployeeRoleId { get; set; } + //[ForeignKey("EmployeeRoleId")] + //[ValidateNever] + //public EmployeeRole EmployeeRole { get; set; } + + public bool IsActive { get; set; } = true; + + public int ProjectId { get; set; } + [ForeignKey("ProjectId")] + [ValidateNever] + public Project Project { get; set; } + + + public DateTime AllocationDate { get; set; } + public DateTime? ReAllocationDate { get; set; } + + + [DisplayName("TenantId")] + public int TenantId { get; set; } + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Projects/WorkArea.cs b/Marco.Pms.Model/Projects/WorkArea.cs new file mode 100644 index 0000000..d9a1774 --- /dev/null +++ b/Marco.Pms.Model/Projects/WorkArea.cs @@ -0,0 +1,40 @@ +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Activities; + +namespace Marco.Pms.Model.Projects +{ + public class WorkArea + { + [Key] + public int Id { get; set; } + + [Required] + [DisplayName("Area Name")] + public string AreaName { get; set; } + + public int FloorId { get; set; } + + [ForeignKey("FloorId")] + [ValidateNever] + public Floor Floor { get; set; } + + //[ValidateNever] + //public List WorkItems { get; set; } + + [DisplayName("TenantId")] + public int TenantId { get; set; } + + [ValidateNever] + [ForeignKey(nameof(TenantId))] + public Tenant Tenant { get; set; } + } +} diff --git a/Marco.Pms.Model/Providers/TenantProvider.cs b/Marco.Pms.Model/Providers/TenantProvider.cs new file mode 100644 index 0000000..9e182d8 --- /dev/null +++ b/Marco.Pms.Model/Providers/TenantProvider.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Providers +{ + public sealed class TenantProvider + { + // https://www.milanjovanovic.tech/blog/multi-tenant-applications-with-ef-core + //https://www.youtube.com/watch?v=Gf1sCvikpgI + private const string TenantIdHeaderName = "X-TenantId"; + + private readonly IHttpContextAccessor _httpContextAccessor; + + public TenantProvider(IHttpContextAccessor httpContextAccessor) + { + _httpContextAccessor = httpContextAccessor; + } + + public string TenantId => _httpContextAccessor + .HttpContext + .Request + .Headers[TenantIdHeaderName]; + } +} diff --git a/Marco.Pms.Model/Utilities/ApiResponse.cs b/Marco.Pms.Model/Utilities/ApiResponse.cs new file mode 100644 index 0000000..269f1bd --- /dev/null +++ b/Marco.Pms.Model/Utilities/ApiResponse.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Utilities +{ + + public class ApiResponse + { + public bool Success { get; set; } + public string Message { get; set; } + public T Data { get; set; } + public object Errors { get; set; } + public int StatusCode { get; set; } + public DateTime Timestamp { get; set; } = DateTime.UtcNow; + + public ApiResponse(bool success, string message, T data, object errors, int statusCode) + { + Success = success; + Message = message; + Data = data; + Errors = errors; + StatusCode = statusCode; + } + + public static ApiResponse SuccessResponse(T data, string message = "Request processed successfully.", int statusCode = 200) + { + return new ApiResponse(true, message, data, null, statusCode); + } + + public static ApiResponse ErrorResponse(string message, object errors = null, int statusCode = 400) + { + return new ApiResponse(false, message, default, errors, statusCode); + } + + } + +} diff --git a/Marco.Pms.Model/Utilities/AuthResponse.cs b/Marco.Pms.Model/Utilities/AuthResponse.cs new file mode 100644 index 0000000..bfeed3b --- /dev/null +++ b/Marco.Pms.Model/Utilities/AuthResponse.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Utilities +{ + public class AuthResponse + { + public string AccessToken { get; set; } + public string RefreshToken { get; set; } + public int ExpiresIn { get; set; } + public object User { get; set; } + } +} diff --git a/Marco.Pms.Model/Utilities/FileDetails.cs b/Marco.Pms.Model/Utilities/FileDetails.cs new file mode 100644 index 0000000..2542a1d --- /dev/null +++ b/Marco.Pms.Model/Utilities/FileDetails.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Utilities +{ + public class FileDetails + { + public int Id { get; set; } + public byte[] FileData { get; set; } // Byte array for the file + public string FileName { get; set; } + public string ContentType { get; set; } + /// + /// Name of the file as stored on disk + /// + public string StoredName { get; set; } + + } +} diff --git a/Marco.Pms.Model/Utilities/FileUploadModel.cs b/Marco.Pms.Model/Utilities/FileUploadModel.cs new file mode 100644 index 0000000..b6d4ff6 --- /dev/null +++ b/Marco.Pms.Model/Utilities/FileUploadModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.Utilities +{ + public class FileUploadModel + { + public string FileName { get; set; } // Name of the file (e.g., "image1.png") + public string Base64Data { get; set; } // Base64-encoded string of the file + public string ContentType { get; set; } // MIME type (e.g., "image/png", "application/pdf") + public long FileSize { get; set; } // File size in bytes + public string Description { get; set; } // Optional: Description or purpose of the file + } +} diff --git a/Marco.Pms.Model/Utilities/SmtpSettings.cs b/Marco.Pms.Model/Utilities/SmtpSettings.cs new file mode 100644 index 0000000..ed64642 --- /dev/null +++ b/Marco.Pms.Model/Utilities/SmtpSettings.cs @@ -0,0 +1,12 @@ +namespace Marco.Pms.Model.Utilities +{ + public class SmtpSettings + { + public string SmtpServer { get; set; } + public int Port { get; set; } + public string SenderName { get; set; } + public string SenderEmail { get; set; } + public string Password { get; set; } + } + +} diff --git a/Marco.Pms.Model/ViewModels/ApplicationRolesVM.cs b/Marco.Pms.Model/ViewModels/ApplicationRolesVM.cs new file mode 100644 index 0000000..9fc0e4b --- /dev/null +++ b/Marco.Pms.Model/ViewModels/ApplicationRolesVM.cs @@ -0,0 +1,20 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.ViewModels +{ + public class ApplicationRolesVM + { + public Guid Id { get; set; } + public string Role { get; set; } + public string Description { get; set; } + public ICollection FeaturePermission { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/Attendance/EmployeeAttendanceVM.cs b/Marco.Pms.Model/ViewModels/Attendance/EmployeeAttendanceVM.cs new file mode 100644 index 0000000..0727f27 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/Attendance/EmployeeAttendanceVM.cs @@ -0,0 +1,17 @@ +using Marco.Pms.Model.Dtos.Attendance; + +namespace Marco.Pms.Model.ViewModels.Attendance +{ + public class EmployeeAttendanceVM + { + public int Id { get; set; } + public int EmployeeId { get; set; } + public string FirstName { get; set; } + public string? LastName { get; set; } + public string? EmployeeAvatar { get; set; } + public DateTime? CheckInTime { get; set; } + public DateTime? CheckOutTime { get; set; } + public ATTENDANCE_MARK_TYPE Activity { get; set; } + + } +} diff --git a/Marco.Pms.Model/ViewModels/EmployeeRolesVM.cs b/Marco.Pms.Model/ViewModels/EmployeeRolesVM.cs new file mode 100644 index 0000000..a7b6c80 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/EmployeeRolesVM.cs @@ -0,0 +1,15 @@ +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; + +namespace Marco.Pms.Model.ViewModels +{ + public class EmployeeRolesVM + { + public Guid Id { get; set; } + public int EmployeeId { get; set; } + public Guid RoleId { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public bool IsEnabled { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/FeaturePermissionVM.cs b/Marco.Pms.Model/ViewModels/FeaturePermissionVM.cs new file mode 100644 index 0000000..27a78dd --- /dev/null +++ b/Marco.Pms.Model/ViewModels/FeaturePermissionVM.cs @@ -0,0 +1,25 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.ViewModels +{ + public class FeaturePermissionVM + { + public Guid Id { get; set; } // Unique identifier for the permission + + + public Guid FeatureId { get; set; } // Foreign key to Feature + + public string Name { get; set; } // Feature name + public string Description { get; set; } // Feature description + + public bool IsEnabled { get; set; } // Whether the feature is enabled for this role + + } +} diff --git a/Marco.Pms.Model/ViewModels/FeatureVM.cs b/Marco.Pms.Model/ViewModels/FeatureVM.cs new file mode 100644 index 0000000..ef1e754 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/FeatureVM.cs @@ -0,0 +1,26 @@ +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Marco.Pms.Model.ViewModels +{ + public class FeatureVM + { + public Guid Id { get; set; } // Unique identifier for the permission + + public string Name { get; set; } // Feature name + public string Description { get; set; } // Feature description + public bool IsActive { get; set; } + public int? ModuleId { get; set; } + + public string? ModuleName { get; set; } + public string? ModuleKey { get; set; } + + public ICollection FeaturePermissions { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/JobRoleVM.cs b/Marco.Pms.Model/ViewModels/JobRoleVM.cs new file mode 100644 index 0000000..8c5e3d5 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/JobRoleVM.cs @@ -0,0 +1,11 @@ +namespace Marco.Pms.Model.ViewModels +{ + public class JobRoleVM + { + + public int Id { get; set; } + public string Name { get; set; } + public string? Description { get; set; } + + } +} diff --git a/Marco.Pms.Model/ViewModels/ProjectDetailsVM.cs b/Marco.Pms.Model/ViewModels/ProjectDetailsVM.cs new file mode 100644 index 0000000..5ef1d64 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/ProjectDetailsVM.cs @@ -0,0 +1,19 @@ +using Marco.Pms.Model.Activities; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Projects; + +namespace Marco.Pms.Model.ViewModels +{ + public class ProjectDetailsVM + { + public Project project { get; set; } + public List employeeAllocation { get; set; } + public List employees { get; set; } + + public List buildings { get; set; } + public List floors { get; set; } + + public List workAreas { get; set; } + public List workItems { get; set; } + } +} diff --git a/Marco.Pms.Model/ViewModels/RolesVM.cs b/Marco.Pms.Model/ViewModels/RolesVM.cs new file mode 100644 index 0000000..1a8d606 --- /dev/null +++ b/Marco.Pms.Model/ViewModels/RolesVM.cs @@ -0,0 +1,13 @@ +using Marco.Pms.Model.Entitlements; + +namespace Marco.Pms.Model.ViewModels +{ + + public class RolesVM + { + public Guid Id { get; set; } + public string Role { get; set; } + + public ICollection FeaturePermissions { get; set; } + } +} diff --git a/Marco.Pms.Model/plantuml/Activities/WorkItem.puml b/Marco.Pms.Model/plantuml/Activities/WorkItem.puml new file mode 100644 index 0000000..02f7345 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Activities/WorkItem.puml @@ -0,0 +1,14 @@ +@startuml +class WorkItem { + + Id : int <> <> + + ActivityId : int <> <> + + WorkAreaId : int <> <> + + PlannedWork : int <> <> + + CompletedWork : int <> <> + + TenantId : int <> <> +} +WorkItem --> "WorkArea" WorkArea +WorkItem --> "ActivityMaster" ActivityMaster +WorkItem --> "TaskDate" DateTime +WorkItem --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Activities/WorkItemMapping.puml b/Marco.Pms.Model/plantuml/Activities/WorkItemMapping.puml new file mode 100644 index 0000000..ce16b29 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Activities/WorkItemMapping.puml @@ -0,0 +1,11 @@ +@startuml +class WorkItemMapping { + + Id : int <> <> + + WorkAreaId : int <> <> + + WorkItemId : int <> <> + + TenantId : int <> <> +} +WorkItemMapping --> "WorkArea" WorkArea +WorkItemMapping --> "WorkItem" WorkItem +WorkItemMapping --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Employees/Attendance.puml b/Marco.Pms.Model/plantuml/Employees/Attendance.puml new file mode 100644 index 0000000..ccc92e8 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Employees/Attendance.puml @@ -0,0 +1,17 @@ +@startuml +class Attendance { + + Id : int <> <> + + Comment : string <> <> + + EmployeeID : int <> <> + + ShiftId : int <> <> + + Latitude : decimal? <> <> + + Longitude : decimal? <> <> + + TenantId : int <> <> + + UpdatedBy : string? <> <> +} +Attendance --> "Employee" Employee +Attendance --> "InTime" DateTime +Attendance --> "OutTime" DateTime +Attendance --> "WorkShift" WorkShift +Attendance --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Employees/Employee.puml b/Marco.Pms.Model/plantuml/Employees/Employee.puml new file mode 100644 index 0000000..9e304a6 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Employees/Employee.puml @@ -0,0 +1,20 @@ +@startuml +class Employee { + + Id : int <> <> + + FirstName : string <> <> + + LastName : string <> <> + + MiddleName : string? <> <> + + Gender : string <> <> + + PeramnentAddress : string <> <> + + CurrentAddress : string <> <> + + PhoneNumber : string <> <> + + EmergencyPhoneNumber : string <> <> + + AadharNumber : string? <> <> + + PanNumber : string? <> <> + + ApplicationUserId : string? <> <> + + TenantId : int <> <> +} +Employee --> "BirthDate" DateTime +Employee --> "ApplicationUser" ApplicationUser +Employee --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Employees/EmployeeAllocation.puml b/Marco.Pms.Model/plantuml/Employees/EmployeeAllocation.puml new file mode 100644 index 0000000..0519680 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Employees/EmployeeAllocation.puml @@ -0,0 +1,20 @@ +@startuml +class EmployeeAllocation { + + Id : int <> <> + + EmployeeId : int <> <> + + ProjectId : int <> <> + + BuildingId : int <> <> + + WorkAreaId : int <> <> + + TenantId : int <> <> +} +class "List`1" { +} +EmployeeAllocation --> "Employee" Employee +EmployeeAllocation --> "EmployeeRole" EMP_ROLES +EmployeeAllocation --> "Project" Project +EmployeeAllocation --> "Building" Building +EmployeeAllocation --> "AllocationDate" DateTime +EmployeeAllocation --> "WorkArea" WorkArea +EmployeeAllocation --> "AllotedTask" "List`1" +EmployeeAllocation --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Employees/EmployeeDetails.puml b/Marco.Pms.Model/plantuml/Employees/EmployeeDetails.puml new file mode 100644 index 0000000..3c840bb --- /dev/null +++ b/Marco.Pms.Model/plantuml/Employees/EmployeeDetails.puml @@ -0,0 +1,6 @@ +@startuml +class EmployeeDetails { + + ProjectId : int <> <> +} +Employee <|-- EmployeeDetails +@enduml diff --git a/Marco.Pms.Model/plantuml/Employees/WorkShift.puml b/Marco.Pms.Model/plantuml/Employees/WorkShift.puml new file mode 100644 index 0000000..b97fd11 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Employees/WorkShift.puml @@ -0,0 +1,10 @@ +@startuml +class WorkShift { + + Id : int <> <> + + Name : string <> <> + + TenantId : int <> <> +} +WorkShift --> "StartTime" TimeOnly +WorkShift --> "EndTime" TimeOnly +WorkShift --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Entitlements/ActivityMaster.puml b/Marco.Pms.Model/plantuml/Entitlements/ActivityMaster.puml new file mode 100644 index 0000000..c86dbae --- /dev/null +++ b/Marco.Pms.Model/plantuml/Entitlements/ActivityMaster.puml @@ -0,0 +1,9 @@ +@startuml +class ActivityMaster { + + Id : int <> <> + + ActivityName : string <> <> + + UnitOfMeasurement : string <> <> + + TenantId : int <> <> +} +ActivityMaster --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Entitlements/AppModule.puml b/Marco.Pms.Model/plantuml/Entitlements/AppModule.puml new file mode 100644 index 0000000..94c9a8c --- /dev/null +++ b/Marco.Pms.Model/plantuml/Entitlements/AppModule.puml @@ -0,0 +1,7 @@ +@startuml +class AppModule { + + Id : int <> <> + + Name : string <> <> + + ModuleKey : string <> <> +} +@enduml diff --git a/Marco.Pms.Model/plantuml/Entitlements/AppModuleRoleMapping.puml b/Marco.Pms.Model/plantuml/Entitlements/AppModuleRoleMapping.puml new file mode 100644 index 0000000..6a279b2 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Entitlements/AppModuleRoleMapping.puml @@ -0,0 +1,16 @@ +@startuml +class AppModuleRoleMapping { + + AppModuleRoleMapping() + + Id : int <> <> + + RoleId : int <> <> + + ModuleId : int <> <> + + TenantId : int <> <> + + AllowView : bool <> <> + + AllowCreate : bool <> <> + + AllowUpdate : bool <> <> + + AllowDelete : bool <> <> +} +AppModuleRoleMapping --> "Role" EmployeeRole +AppModuleRoleMapping --> "Module" AppModule +AppModuleRoleMapping --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Entitlements/ApplicationUser.puml b/Marco.Pms.Model/plantuml/Entitlements/ApplicationUser.puml new file mode 100644 index 0000000..74244c6 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Entitlements/ApplicationUser.puml @@ -0,0 +1,8 @@ +@startuml +class ApplicationUser { + + Role : string <> <> + + TenantId : int <> <> + + IsRootUser : bool? <> <> +} +IdentityUser <|-- ApplicationUser +@enduml diff --git a/Marco.Pms.Model/plantuml/Entitlements/EmployeeRole.puml b/Marco.Pms.Model/plantuml/Entitlements/EmployeeRole.puml new file mode 100644 index 0000000..dac82c4 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Entitlements/EmployeeRole.puml @@ -0,0 +1,8 @@ +@startuml +class EmployeeRole { + + Id : int <> <> + + Role : string <> <> + + TenantId : int <> <> +} +EmployeeRole --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Entitlements/StatusMaster.puml b/Marco.Pms.Model/plantuml/Entitlements/StatusMaster.puml new file mode 100644 index 0000000..cb69db5 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Entitlements/StatusMaster.puml @@ -0,0 +1,8 @@ +@startuml +class StatusMaster { + + Id : int <> <> + + Status : string <> <> + + TenantId : int <> <> +} +StatusMaster --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Entitlements/Tenent.puml b/Marco.Pms.Model/plantuml/Entitlements/Tenent.puml new file mode 100644 index 0000000..633a229 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Entitlements/Tenent.puml @@ -0,0 +1,11 @@ +@startuml +class Tenant { + + Id : int <> <> + + Name : string <> <> + + Description : string <> <> + + DomainName : string <> <> + + ContactName : string <> <> + + ContactNumber : string <> <> +} +Tenant --> "OnBoardingDate" DateTime +@enduml diff --git a/Marco.Pms.Model/plantuml/Projects/Building.puml b/Marco.Pms.Model/plantuml/Projects/Building.puml new file mode 100644 index 0000000..2a3810b --- /dev/null +++ b/Marco.Pms.Model/plantuml/Projects/Building.puml @@ -0,0 +1,9 @@ +@startuml +class Building { + + Id : int <> <> + + Name : string <> <> + + ProjectId : int <> <> + + TenantId : int <> <> +} +Building --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Projects/Floor.puml b/Marco.Pms.Model/plantuml/Projects/Floor.puml new file mode 100644 index 0000000..be3e6f7 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Projects/Floor.puml @@ -0,0 +1,10 @@ +@startuml +class Floor { + + Id : int <> <> + + FloorName : string <> <> + + BuildingId : int <> <> + + TenantId : int <> <> +} +Floor --> "Building" Building +Floor --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Projects/PhotoGallary.puml b/Marco.Pms.Model/plantuml/Projects/PhotoGallary.puml new file mode 100644 index 0000000..859745c --- /dev/null +++ b/Marco.Pms.Model/plantuml/Projects/PhotoGallary.puml @@ -0,0 +1,12 @@ +@startuml +class PhotoGallary { + + Id : int <> <> + + Description : string <> <> + + ProjectId : int <> <> + + AddedBy : string <> <> + + <> Imagebase64 : string <> <> +} +PhotoGallary --> "Project" Project +PhotoGallary --> "ApplicationUser" ApplicationUser +PhotoGallary --> "AddedOn" DateTime +@enduml diff --git a/Marco.Pms.Model/plantuml/Projects/Project.puml b/Marco.Pms.Model/plantuml/Projects/Project.puml new file mode 100644 index 0000000..908d2d5 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Projects/Project.puml @@ -0,0 +1,14 @@ +@startuml +class Project { + + Id : int <> <> + + Name : string <> <> + + ProjectAddress : string <> <> + + ContactPerson : string <> <> + + ProjectStatusId : int <> <> + + TenantId : int <> <> +} +Project --> "StartDate" DateTime +Project --> "EndDate" DateTime +Project --> "ProjectStatus" StatusMaster +Project --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/Projects/WorkArea.puml b/Marco.Pms.Model/plantuml/Projects/WorkArea.puml new file mode 100644 index 0000000..b886d57 --- /dev/null +++ b/Marco.Pms.Model/plantuml/Projects/WorkArea.puml @@ -0,0 +1,10 @@ +@startuml +class WorkArea { + + Id : int <> <> + + AreaName : string <> <> + + FloorId : int <> <> + + TenantId : int <> <> +} +WorkArea --> "Floor" Floor +WorkArea --> "Tenant" Tenant +@enduml diff --git a/Marco.Pms.Model/plantuml/ViewModels/AttendanceVM.puml b/Marco.Pms.Model/plantuml/ViewModels/AttendanceVM.puml new file mode 100644 index 0000000..bdcb4c9 --- /dev/null +++ b/Marco.Pms.Model/plantuml/ViewModels/AttendanceVM.puml @@ -0,0 +1,9 @@ +@startuml +class AttendanceVM { +} +class "IEnumerable`1" { +} +AttendanceVM --> "Employee" Employee +AttendanceVM --> "Attendance" Attendance +AttendanceVM --> "AttendanceList" "IEnumerable`1" +@enduml diff --git a/Marco.Pms.Model/plantuml/ViewModels/ProjectDetailsVM.puml b/Marco.Pms.Model/plantuml/ViewModels/ProjectDetailsVM.puml new file mode 100644 index 0000000..5d652f3 --- /dev/null +++ b/Marco.Pms.Model/plantuml/ViewModels/ProjectDetailsVM.puml @@ -0,0 +1,13 @@ +@startuml +class ProjectDetailsVM { +} +class "List`1" { +} +ProjectDetailsVM --> "project" Project +ProjectDetailsVM --> "employeeAllocation" "List`1" +ProjectDetailsVM --> "employees" "List`1" +ProjectDetailsVM --> "buildings" "List`1" +ProjectDetailsVM --> "floors" "List`1" +ProjectDetailsVM --> "workAreas" "List`1" +ProjectDetailsVM --> "workItems" "List`1" +@enduml diff --git a/Marco.Pms.Model/plantuml/include.puml b/Marco.Pms.Model/plantuml/include.puml new file mode 100644 index 0000000..8bac434 --- /dev/null +++ b/Marco.Pms.Model/plantuml/include.puml @@ -0,0 +1,202 @@ +@startuml +class WorkItem { + + Id : int <> <> + + ActivityId : int <> <> + + WorkAreaId : int <> <> + + PlannedWork : int <> <> + + CompletedWork : int <> <> + + TenantId : int <> <> +} +WorkItem --> "WorkArea" WorkArea +WorkItem --> "ActivityMaster" ActivityMaster +WorkItem --> "TaskDate" DateTime +WorkItem --> "Tenant" Tenant +class WorkItemMapping { + + Id : int <> <> + + WorkAreaId : int <> <> + + WorkItemId : int <> <> + + TenantId : int <> <> +} +WorkItemMapping --> "WorkArea" WorkArea +WorkItemMapping --> "WorkItem" WorkItem +WorkItemMapping --> "Tenant" Tenant +class Attendance { + + Id : int <> <> + + Comment : string <> <> + + EmployeeID : int <> <> + + ShiftId : int <> <> + + Latitude : decimal? <> <> + + Longitude : decimal? <> <> + + TenantId : int <> <> + + UpdatedBy : string? <> <> +} +Attendance --> "Employee" Employee +Attendance --> "InTime" DateTime +Attendance --> "OutTime" DateTime +Attendance --> "WorkShift" WorkShift +Attendance --> "Tenant" Tenant +class Employee { + + Id : int <> <> + + FirstName : string <> <> + + LastName : string <> <> + + MiddleName : string? <> <> + + Gender : string <> <> + + PeramnentAddress : string <> <> + + CurrentAddress : string <> <> + + PhoneNumber : string <> <> + + EmergencyPhoneNumber : string <> <> + + AadharNumber : string? <> <> + + PanNumber : string? <> <> + + ApplicationUserId : string? <> <> + + TenantId : int <> <> +} +Employee --> "BirthDate" DateTime +Employee --> "ApplicationUser" ApplicationUser +Employee --> "Tenant" Tenant +class EmployeeAllocation { + + Id : int <> <> + + EmployeeId : int <> <> + + ProjectId : int <> <> + + BuildingId : int <> <> + + WorkAreaId : int <> <> + + TenantId : int <> <> +} +class "List`1" { +} +EmployeeAllocation --> "Employee" Employee +EmployeeAllocation --> "EmployeeRole" EMP_ROLES +EmployeeAllocation --> "Project" Project +EmployeeAllocation --> "Building" Building +EmployeeAllocation --> "AllocationDate" DateTime +EmployeeAllocation --> "WorkArea" WorkArea +EmployeeAllocation --> "AllotedTask" "List`1" +EmployeeAllocation --> "Tenant" Tenant +class EmployeeDetails { + + ProjectId : int <> <> +} +Employee <|-- EmployeeDetails +class WorkShift { + + Id : int <> <> + + Name : string <> <> + + TenantId : int <> <> +} +WorkShift --> "StartTime" TimeOnly +WorkShift --> "EndTime" TimeOnly +WorkShift --> "Tenant" Tenant +class ActivityMaster { + + Id : int <> <> + + ActivityName : string <> <> + + UnitOfMeasurement : string <> <> + + TenantId : int <> <> +} +ActivityMaster --> "Tenant" Tenant +class ApplicationUser { + + Role : string <> <> + + TenantId : int <> <> + + IsRootUser : bool? <> <> +} +IdentityUser <|-- ApplicationUser +class AppModule { + + Id : int <> <> + + Name : string <> <> + + ModuleKey : string <> <> +} +class AppModuleRoleMapping { + + AppModuleRoleMapping() + + Id : int <> <> + + RoleId : int <> <> + + ModuleId : int <> <> + + TenantId : int <> <> + + AllowView : bool <> <> + + AllowCreate : bool <> <> + + AllowUpdate : bool <> <> + + AllowDelete : bool <> <> +} +AppModuleRoleMapping --> "Role" EmployeeRole +AppModuleRoleMapping --> "Module" AppModule +AppModuleRoleMapping --> "Tenant" Tenant +class EmployeeRole { + + Id : int <> <> + + Role : string <> <> + + TenantId : int <> <> +} +EmployeeRole --> "Tenant" Tenant +class StatusMaster { + + Id : int <> <> + + Status : string <> <> + + TenantId : int <> <> +} +StatusMaster --> "Tenant" Tenant +class Tenant { + + Id : int <> <> + + Name : string <> <> + + Description : string <> <> + + DomainName : string <> <> + + ContactName : string <> <> + + ContactNumber : string <> <> +} +Tenant --> "OnBoardingDate" DateTime +class Building { + + Id : int <> <> + + Name : string <> <> + + ProjectId : int <> <> + + TenantId : int <> <> +} +Building --> "Tenant" Tenant +class Floor { + + Id : int <> <> + + FloorName : string <> <> + + BuildingId : int <> <> + + TenantId : int <> <> +} +Floor --> "Building" Building +Floor --> "Tenant" Tenant +class PhotoGallary { + + Id : int <> <> + + Description : string <> <> + + ProjectId : int <> <> + + AddedBy : string <> <> + + <> Imagebase64 : string <> <> +} +PhotoGallary --> "Project" Project +PhotoGallary --> "ApplicationUser" ApplicationUser +PhotoGallary --> "AddedOn" DateTime +class Project { + + Id : int <> <> + + Name : string <> <> + + ProjectAddress : string <> <> + + ContactPerson : string <> <> + + ProjectStatusId : int <> <> + + TenantId : int <> <> +} +Project --> "StartDate" DateTime +Project --> "EndDate" DateTime +Project --> "ProjectStatus" StatusMaster +Project --> "Tenant" Tenant +class WorkArea { + + Id : int <> <> + + AreaName : string <> <> + + FloorId : int <> <> + + TenantId : int <> <> +} +WorkArea --> "Floor" Floor +WorkArea --> "Tenant" Tenant +class AttendanceVM { +} +class "IEnumerable`1" { +} +AttendanceVM --> "Employee" Employee +AttendanceVM --> "Attendance" Attendance +AttendanceVM --> "AttendanceList" "IEnumerable`1" +class ProjectDetailsVM { +} +class "List`1" { +} +ProjectDetailsVM --> "project" Project +ProjectDetailsVM --> "employeeAllocation" "List`1" +ProjectDetailsVM --> "employees" "List`1" +ProjectDetailsVM --> "buildings" "List`1" +ProjectDetailsVM --> "floors" "List`1" +ProjectDetailsVM --> "workAreas" "List`1" +ProjectDetailsVM --> "workItems" "List`1" +@enduml diff --git a/Marco.Pms.Services/Controllers/ActivityController.cs b/Marco.Pms.Services/Controllers/ActivityController.cs new file mode 100644 index 0000000..4acfb73 --- /dev/null +++ b/Marco.Pms.Services/Controllers/ActivityController.cs @@ -0,0 +1,69 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace MarcoBMS.Services.Controllers +{ + + [Route("api/[controller]")] + [ApiController] + [Authorize] + public class ActivityController : ControllerBase + { + private readonly ApplicationDbContext _context; + private ApplicationUser _applicationUser; + private readonly IEmployeeRepository _empRepo; + private readonly UserManager _userManager; + private readonly IEmailSender _emailSender; + + + public ActivityController(UserManager userManager, IEmailSender emailSender, IEmployeeRepository empRepo, ApplicationDbContext context) + { + _context = context; + _empRepo = empRepo; + _userManager = userManager; + _emailSender = emailSender; + } + + //[HttpPost("checkin")] + //public async Task CheckIn(int employeeId, string latitude, string longitude) + //{ + // var now = DateTime.UtcNow; + // var date = now.Date; + + // var attendanceLog = new AttendanceLog + // { + // EmployeeID = employeeId, + // //InTime = now, + // Latitude = latitude, + // Longitude = longitude + // }; + // _context.AttendanceLogs.Add(attendanceLog); + + // var attendance = await _context.Attendances + // .FirstOrDefaultAsync(a => a.EmployeeID == employeeId && a.Date == date); + + // if (attendance == null) + // { + // attendance = new Attendance + // { + // EmployeeID = employeeId, + // Date = date, + // InTimeLog = attendanceLog + // }; + // _context.Attendances.Add(attendance); + // } + + + + // await _context.SaveChangesAsync(); + // return Ok(new { Message = "Check-in recorded." }); + //} + } +} diff --git a/Marco.Pms.Services/Controllers/AttendanceController.cs b/Marco.Pms.Services/Controllers/AttendanceController.cs new file mode 100644 index 0000000..c462f44 --- /dev/null +++ b/Marco.Pms.Services/Controllers/AttendanceController.cs @@ -0,0 +1,300 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.AttendanceModule; +using Marco.Pms.Model.Dtos.Attendance; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels.Attendance; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.CodeAnalysis; +using Microsoft.EntityFrameworkCore; +using System.Globalization; + +namespace MarcoBMS.Services.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class AttendanceController : ControllerBase + { + private readonly IUnitOfWork _unitOfWork; + private readonly ApplicationDbContext _context; + private readonly UserManager _userManager; + private readonly IEmailSender _emailSender; + private readonly IAttendenceRepository _attendenceRepository; + private readonly EmployeeHelper _employeeHelper; + private readonly ProjectHelper _projectHelper; + + + + + + public AttendanceController(UserManager userManager, IEmailSender emailSender, IEmployeeRepository empRepo, + IUnitOfWork unitOfWork, ApplicationDbContext context, IAttendenceRepository attendenceRepository, EmployeeHelper employeeHelper, ProjectHelper projectHelper) + { + _unitOfWork = unitOfWork; + _context = context; + _userManager = userManager; + _emailSender = emailSender; + _attendenceRepository = attendenceRepository; + _employeeHelper = employeeHelper; + _projectHelper = projectHelper; + } + + private int GetTenantId() + { + var tenant = User.FindFirst("TenantId")?.Value; + return (tenant != null ? Convert.ToInt32(tenant) : 1); + } + private int GetUserId() + { + var tenant = User.FindFirst("Id")?.Value; + return (tenant != null ? Convert.ToInt32(tenant) : 1); + } + + [HttpGet("log/attendance/{attendanceid}")] + + public async Task GetAttendanceLogById(int attendanceid) + { + int TenantId = GetUserId(); + + List lstAttendance = await _context.AttendanceLogs.Where(c => c.AttendanceId == attendanceid && c.TenantId == TenantId).ToListAsync(); + + return Ok(ApiResponse.SuccessResponse(lstAttendance, String.Format("{0} Attendance records fetched successfully", lstAttendance.Count), 200)); + + } + [HttpGet("log/employee/{employeeid}")] + + public async Task GetAttendanceLogByEmployeeId(int employeeid, [FromQuery] string? date = null) + { + int TenantId = GetUserId(); + DateOnly forDate = new DateOnly(); + + if (date != null && DateOnly.TryParse(date, out forDate) == false) + { + return StatusCode(400, ApiResponse.SuccessResponse(date, "Invalid Date", 400));// new { error = ex.Message }); + + } + List lstAttendance = await _context.AttendanceLogs.Where(c => c.EmployeeID == employeeid && c.TenantId == TenantId).ToListAsync(); + + return Ok(ApiResponse.SuccessResponse(lstAttendance, System.String.Format("{0} Attendance records fetched successfully", lstAttendance.Count), 200)); + + + } + + /// + /// + /// + /// ProjectID + /// YYYY-MM-dd + /// + [HttpGet("project/team")] + + public async Task EmployeeAttendanceByProject([FromQuery] int projectId, [FromQuery] string? date = null) + { + int TenantId = GetUserId(); + DateTime forDate = new DateTime(); + + if (date != null && DateTime.TryParse(date, out forDate) == false) + { + return StatusCode(400, ApiResponse.SuccessResponse(date, "Invalid Date", 400));// new { error = ex.Message }); + + } + if (projectId <= 0) + { + return BadRequest("Project ID is required and must be greater than zero."); + } + + var result = new List(); + Attendance attendance = null; + + if (date == null) forDate = DateTime.UtcNow.Date; + + List lstAttendance = await _context.Attendes.Where(c => c.ProjectID == projectId && c.AttendanceDate.Date == forDate && c.TenantId == TenantId).ToListAsync(); + + + List projectteam = await _projectHelper.GetTeamByProject(TenantId, projectId, true); + foreach (ProjectAllocation teamMember in projectteam) + { + + var result1 = new EmployeeAttendanceVM() + { + EmployeeAvatar = null, + EmployeeId = teamMember.EmployeeId, + FirstName = teamMember.Employee.FirstName, + LastName = teamMember.Employee.LastName + }; + + attendance = lstAttendance.Find(x => x.EmployeeID == teamMember.EmployeeId); + if (attendance != null) + { + result1.Id = attendance.Id; + result1.CheckInTime = attendance.InTime; + result1.CheckOutTime = attendance.OutTime; + result1.Activity = attendance.Activity; + } + + result.Add(result1); + } + + return Ok(ApiResponse.SuccessResponse(result, System.String.Format("{0} Attendance records fetched successfully", result.Count), 200)); + } + + + [HttpPost] + [Route("record")] + public async Task RecordAttendance([FromBody] RecordAttendanceDot recordAttendanceDot) + { + if (!ModelState.IsValid) + return BadRequest(ModelState); + + int TenantId = GetTenantId(); + + using var transaction = await _context.Database.BeginTransactionAsync(); + try + { + Attendance attendance = await _context.Attendes.FirstOrDefaultAsync(a => a.EmployeeID == recordAttendanceDot.EmployeeID && + a.AttendanceDate.Date == recordAttendanceDot.Date.Date && a.TenantId == TenantId); ; + + + if (attendance != null) + { + attendance.Comment = recordAttendanceDot.Comment; + if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.CHECK_IN) + { + attendance.OutTime = null; + attendance.Activity = ATTENDANCE_MARK_TYPE.CHECK_OUT; + } + else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.CHECK_OUT) + { + attendance.IsApproved = true; + attendance.Activity = ATTENDANCE_MARK_TYPE.REGULARIZE; + + + //string timeString = "10:30 PM"; // Format: "hh:mm tt" + + DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime); + + attendance.OutTime = finalDateTime; + } + else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE) + { + DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime); + + attendance.OutTime = finalDateTime; + attendance.Activity = ATTENDANCE_MARK_TYPE.REQUEST_REGULARIZE; + // do nothing + } + else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE) + { + attendance.IsApproved = true; + attendance.Activity = ATTENDANCE_MARK_TYPE.REGULARIZE; + // do nothing + } + else if (recordAttendanceDot.Action == ATTENDANCE_MARK_TYPE.REGULARIZE_REJECT) + { + attendance.IsApproved = false; + attendance.Activity = ATTENDANCE_MARK_TYPE.REGULARIZE_REJECT; + // do nothing + } + attendance.Date = DateTime.UtcNow; + + // update code + _context.Attendes.Update(attendance); + } + else + { + attendance = new Attendance(); + attendance.TenantId = TenantId; + attendance.AttendanceDate = recordAttendanceDot.Date; + // attendance.Activity = recordAttendanceDot.Action; + attendance.Comment = recordAttendanceDot.Comment; + attendance.EmployeeID = recordAttendanceDot.EmployeeID; + attendance.ProjectID = recordAttendanceDot.ProjectID; + attendance.Date = DateTime.UtcNow; + + + DateTime finalDateTime = GetDateFromTimeStamp(recordAttendanceDot, recordAttendanceDot.MarkTime); + + attendance.InTime = finalDateTime; + attendance.OutTime = null; + attendance.Activity = ATTENDANCE_MARK_TYPE.CHECK_OUT; + + _context.Attendes.Add(attendance); + } + + await _context.SaveChangesAsync(); + + + // Step 3: Always insert a new log entry + var attendanceLog = new AttendanceLog + { + AttendanceId = attendance.Id, // Use existing or new AttendanceId + Activity = attendance.Activity, + + ActivityTime = recordAttendanceDot.Date, + Comment = recordAttendanceDot.Comment, + EmployeeID = recordAttendanceDot.EmployeeID, + Latitude = recordAttendanceDot.Latitude, + Longitude = recordAttendanceDot.Longitude, + + TenantId = TenantId, + UpdatedBy = GetUserId(), + UpdatedOn = DateTime.UtcNow + }; + //if (recordAttendanceDot.Image != null && recordAttendanceDot.Image.Count > 0) + //{ + // attendanceLog.Photo = recordAttendanceDot.Image[0].Base64Data; + //} + + + _context.AttendanceLogs.Add(attendanceLog); + await _context.SaveChangesAsync(); + + await transaction.CommitAsync(); // Commit transaction + + Employee employee = await _employeeHelper.GetEmployeeByID(recordAttendanceDot.EmployeeID); + EmployeeAttendanceVM vm = new EmployeeAttendanceVM() + { + CheckInTime = attendance.InTime, + CheckOutTime = attendance.OutTime, + EmployeeAvatar = null, + EmployeeId = recordAttendanceDot.EmployeeID, + FirstName = employee.FirstName, + LastName = employee.LastName, + Id = attendance.Id, + Activity = attendance.Activity + }; + + return Ok(ApiResponse.SuccessResponse(vm, "Attendance marked successfully.", 200)); + + } + catch (Exception ex) + { + await transaction.RollbackAsync(); // Rollback on failure + return StatusCode(500, ApiResponse.SuccessResponse(new object(), ex.Message, 500));// new { error = ex.Message }); + } + + + + return Ok(ApiResponse.SuccessResponse("success", "Roles modified.", 200)); + } + + private static DateTime GetDateFromTimeStamp(RecordAttendanceDot recordAttendanceDot, string timeString) + { + DateTime date = recordAttendanceDot.Date; + + + + // Parse time string to TimeSpan + DateTime parsedTime = DateTime.ParseExact(timeString, "hh:mm tt", CultureInfo.InvariantCulture); + + // Combine date with time + DateTime finalDateTime = new DateTime(date.Year, date.Month, date.Day, parsedTime.Hour, parsedTime.Minute, 0); + return finalDateTime; + } + } +} diff --git a/Marco.Pms.Services/Controllers/AuthController.cs b/Marco.Pms.Services/Controllers/AuthController.cs new file mode 100644 index 0000000..d722b2a --- /dev/null +++ b/Marco.Pms.Services/Controllers/AuthController.cs @@ -0,0 +1,129 @@ +using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Dtos; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace MarcoBMS.Services.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class AuthController : ControllerBase + { + private readonly UserManager _userManager; + private readonly JwtSettings _jwtSettings; + private readonly RefreshTokenService _refreshTokenService; + string tenentId = "1"; + public AuthController(UserManager userManager, JwtSettings jwtSettings, RefreshTokenService refreshTokenService) + { + _userManager = userManager; + _jwtSettings = jwtSettings; + _refreshTokenService = refreshTokenService; + } + + [HttpPost("login")] + public async Task Login([FromBody] LoginDto loginDto) + { + var user = await _userManager.FindByEmailAsync(loginDto.Username); + var user1 = await _userManager.Users.FirstOrDefaultAsync(u => u.Email == loginDto.Username || u.PhoneNumber == loginDto.Username); + + + if (user == null || !await _userManager.CheckPasswordAsync(user, loginDto.Password)) + { + return Unauthorized("Invalid username or password."); + } + + var token = _refreshTokenService.GenerateJwtToken(user.UserName, tenentId, _jwtSettings); + + + //var refreshToken = GenerateRefreshToken(); + + var refreshToken = await _refreshTokenService.CreateRefreshToken(user.Id, tenentId, _jwtSettings); + + return Ok(new { token, refreshToken }); + } + + [HttpPost("logout")] + public async Task Logout([FromBody] LogoutDto logoutDto) + { + if (string.IsNullOrEmpty(logoutDto.RefreshToken)) + { + return BadRequest(new { Message = "Refresh token is required" }); + } + + try + { + // Revoke the refresh token + bool isRevoked = await _refreshTokenService.RevokeRefreshTokenAsync(logoutDto.RefreshToken); + + if (!isRevoked) + return Unauthorized(new { Message = "Invalid or expired refresh token" }); + + // Optional: Blacklist the access token (JWT) + string jwtToken = HttpContext.Request.Headers["Authorization"].ToString().Replace("Bearer ", ""); + if (!string.IsNullOrEmpty(jwtToken)) + { + await _refreshTokenService.BlacklistJwtTokenAsync(jwtToken); + } + + return Ok(new { Message = "Logged out successfully" }); + } + catch (Exception ex) + { + // _logger.LogError(ex, "Error during logout"); + return StatusCode(500, new { Message = "Internal server error" }); + } + } + + + [HttpPost("register")] + public async Task Register([FromBody] RegisterDto registerDto) + { + var user = new IdentityUser { UserName = registerDto.Username, Email = registerDto.Email }; + var result = await _userManager.CreateAsync(user, registerDto.Password); + + if (!result.Succeeded) + { + return BadRequest(result.Errors); + } + + return Ok("User registered successfully."); + } + + [HttpPost("refresh-token")] + public async Task RefreshToken([FromBody] RefreshTokenDto refreshTokenDto) + { + var refreshToken = await _refreshTokenService.GetRefreshToken(refreshTokenDto.RefreshToken); + if (refreshToken == null || refreshToken.ExpiryDate < DateTime.UtcNow) + { + return Unauthorized("Invalid or expired refresh token."); + } + + // Mark token as used + await _refreshTokenService.MarkRefreshTokenAsUsed(refreshToken); + + // Generate new JWT token and refresh token + var user = await _userManager.FindByIdAsync(refreshToken.UserId); + var newJwtToken = _refreshTokenService.GenerateJwtToken(user.UserName, tenentId, _jwtSettings); + var newRefreshToken = await _refreshTokenService.CreateRefreshToken(user.Id, tenentId, _jwtSettings); + + return Ok(new { token = newJwtToken, refreshToken = newRefreshToken }); + } + + [HttpPost("forgot-password")] + public async Task ForgotPassword([FromBody] ForgotPasswordDto forgotPasswordDto) + { + var user = await _userManager.FindByEmailAsync(forgotPasswordDto.Email); + if (user == null) return NotFound("User not found."); + + var token = await _userManager.GeneratePasswordResetTokenAsync(user); + + // Send token via email (implementation omitted) + // ... + + return Ok("Password reset link sent."); + } + } +} diff --git a/Marco.Pms.Services/Controllers/EmployeeController.cs b/Marco.Pms.Services/Controllers/EmployeeController.cs new file mode 100644 index 0000000..18d3924 --- /dev/null +++ b/Marco.Pms.Services/Controllers/EmployeeController.cs @@ -0,0 +1,369 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Dtos.Employees; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using System.Data; + +namespace MarcoBMS.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + [Authorize] + + public class EmployeeController : ControllerBase + { + + private readonly IUnitOfWork _unitOfWork; + private readonly ApplicationDbContext _context; + private readonly UserManager _userManager; + private readonly IEmailSender _emailSender; + + + public EmployeeController(UserManager userManager, IEmailSender emailSender, IEmployeeRepository empRepo, IUnitOfWork unitOfWork, ApplicationDbContext context) + { + _unitOfWork = unitOfWork; + _context = context; + _userManager = userManager; + _emailSender = emailSender; + } + + [HttpGet] + [Route("roles/{employeeId?}")] + public async Task GetRoles(int employeeId) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + int tenantId = GetTenantId(); + + var empRoles = _context.EmployeeRoleMappings.Where(c => c.EmployeeId == employeeId).Include(c => c.Role).Include(c => c.Employee).ToList(); + if (empRoles.Any()) + { + List roles = new List(); + + foreach (EmployeeRoleMapping mapping in empRoles) + { + roles.Add(new EmployeeRolesVM() + { + Id = mapping.Id, + EmployeeId = mapping.EmployeeId, + Name = mapping.Role.Role, + Description = mapping.Role.Description, + IsEnabled = mapping.IsEnabled, + RoleId = mapping.RoleId, + }); + } + return Ok(ApiResponse.SuccessResponse(roles, "Success.", 200)); + } + else + { + return Ok(ApiResponse.SuccessResponse(new List(), "Success.", 200)); + } + } + + [HttpPost] + [Route("roles")] + public async Task ManageRoles([FromBody] List employeeRoleDots) + { + if (!ModelState.IsValid) + return BadRequest(ModelState); + + int TenantId = GetTenantId(); + try + { + foreach (EmployeeRoleDot role in employeeRoleDots) + { + EmployeeRoleMapping mapping = role.ToEmployeeRoleMappingFromEmployeeRoleDot(TenantId); + + var existingItem = await _context.EmployeeRoleMappings.AsNoTracking().SingleOrDefaultAsync(c => c.Id == mapping.Id); + + if (existingItem == null) + { + + _context.EmployeeRoleMappings.Add(mapping); + } + else + { + _context.EmployeeRoleMappings.Update(mapping); + } + } + await _context.SaveChangesAsync(); + } + catch (Exception ex) { + } + return Ok(ApiResponse.SuccessResponse("success", "Roles modified.", 200)); + } + + [HttpGet] + [Route("search/{name}/{projectid?}")] + public async Task SearchEmployee(string name, int? projectid) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + int TenantId = GetTenantId(); + name = name.ToLower(); + int tenantId = GetTenantId(); + List employees = await _unitOfWork.Employee.GetAsync(c => c.TenantId == tenantId && (c.FirstName.ToLower().StartsWith(name) + || c.MiddleName.ToLower().StartsWith(name) || c.LastName.ToLower().StartsWith(name))); + + + employees = employees.Where(c => c.FirstName.ToLower().StartsWith(name) + || c.MiddleName.ToLower().StartsWith(name) || c.LastName.ToLower().StartsWith(name)).ToList(); + + if (projectid != null) + { + // conditions to e checked after project assignment + } + return Ok(ApiResponse.SuccessResponse(employees, "Filter applied.", 200)); + + } + + [HttpGet] + [Route("get/{projectid?}")] + public async Task GetEmployee(int? projectid) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + int TenantId = GetTenantId(); + + List employees = await _unitOfWork.Employee.GetAsync(c => c.TenantId == TenantId); + + employees = employees.Where(c => c.TenantId == TenantId).ToList(); + + if (projectid != null) + { + // Fetch assigned project + } + + return Ok(employees); + } + + //[HttpGet] + //[Route("attendance/project/{projectid?}")] + //public async Task GetAttendanceList(int? projectid) + //{ + // if (!ModelState.IsValid) + // { + // return BadRequest(ModelState); + // } + // int TenantId = GetTenantId(); + + + // DateTime today = DateTime.Today; + + // var result = from employee in _context.ProjectAllocations + // join attendance in _context.Attendances + // on employee.Id equals attendance.EmployeeID into attendanceGroup + // from todayAttendance in attendanceGroup + // //.Where(a => a.InTimeLog.InTime == today) + // .DefaultIfEmpty() // LEFT JOIN + // select new + // { + // ProjectID = projectid, + // EmployeeId = employee.Id, + // FirstName = employee.Employee.FirstName, + // MiddleName = employee.Employee.MiddleName, + // LastName = employee.Employee.LastName, + // PhoneNumber = employee.Employee.PhoneNumber, + // RoleId = employee.Employee.JobRoleId, + // //InTime = todayAttendance.InTimeLog != null ? todayAttendance.InTimeLog.InTime : (DateTime?)null, + // //OutTime = todayAttendance.OutTimeLog != null ? todayAttendance.OutTimeLog.OutTime : (DateTime?)null, + // // WorkShift = todayAttendance.WorkShift, + // Latitude = todayAttendance.InTimeLog != null ? todayAttendance.InTimeLog.Latitude : null, + // Longitude = todayAttendance.InTimeLog != null ? todayAttendance.InTimeLog.Longitude : null, + // Comment = todayAttendance.Comment, + // }; + + + + // return Ok(result); + + //} + private int GetTenantId() + { + var tenant = User.FindFirst("TenantId")?.Value; + return (tenant != null ? Convert.ToInt32(tenant) : 1); + } + + [HttpPost("manage/quick")] + public async Task CreateQuickUser([FromBody] CreateQuickUserDto model) + { + return Ok("Pending implementation"); + } + [HttpPost("manage")] + public async Task CreateUser([FromForm] CreateUserDto model) + { + if (model == null) + return BadRequest("Invalid user data."); + + int TenantId = GetTenantId(); + if (model.Email != null) + { + // Check if user already exists by email + var existingUser = await _userManager.FindByEmailAsync(model.Email); + if (existingUser != null) + { + // Update existing user + //existingUser.Email = model.Email; // No need to update email + + //var updateResult = await _userManager.UpdateAsync(existingUser); + //if (!updateResult.Succeeded) + // return BadRequest(updateResult.Errors); + + // Update Employee record + var existingEmployee = await _context.Employees.FirstOrDefaultAsync(e => e.ApplicationUserId == existingUser.Id); + if (existingEmployee != null) + { + existingEmployee.FirstName = model.FirstName; + existingEmployee.LastName = model.LastName; + existingEmployee.TenantId = TenantId; + existingEmployee.Email = model.Email; + existingEmployee.JobRoleId = Convert.ToInt32(model.JobRoleId); + + _context.Employees.Update(existingEmployee); + } + else + { + // Create Employee record if missing + var newEmployee = new Employee + { + ApplicationUserId = existingUser.Id, + FirstName = model.FirstName, + LastName = model.LastName, + Email = model.Email, + TenantId = TenantId, + CurrentAddress = model.CurrentAddress, + BirthDate = Convert.ToDateTime(model.BirthDate), + EmergencyPhoneNumber = model.EmergencyPhoneNumber, + AadharNumber = model.AadharNumber, + Gender = model.Gender, + MiddleName = model.MiddleName, + PanNumber = model.PanNumber, + PeramnentAddress = model.PeramnentAddress, + PhoneNumber = model.PhoneNumber, + Photo = GetFileDetails(model.Photo).Result.FileData, + JobRoleId = Convert.ToInt32(model.JobRoleId) + + }; + _context.Employees.Add(newEmployee); + } + + await _context.SaveChangesAsync(); + + return Ok(new { message = "User updated successfully." }); + } + + var user = new ApplicationUser + { + UserName = model.Email, + Email = model.Email, + EmailConfirmed = true + }; + + // Create Identity User + var result = await _userManager.CreateAsync(user, "User@123"); + if (!result.Succeeded) + return BadRequest(result.Errors); + + // Save Employee Data + var employee = new Employee + { + FirstName = model.FirstName, + LastName = model.LastName, + Email = model.Email, + TenantId = TenantId, + CurrentAddress = model.CurrentAddress, + BirthDate = Convert.ToDateTime(model.BirthDate), + EmergencyPhoneNumber = model.EmergencyPhoneNumber, + AadharNumber = model.AadharNumber, + Gender = model.Gender, + MiddleName = model.MiddleName, + PanNumber = model.PanNumber, + PeramnentAddress = model.PeramnentAddress, + PhoneNumber = model.PhoneNumber, + Photo = GetFileDetails(model.Photo).Result.FileData, + JobRoleId = Convert.ToInt32(model.JobRoleId) + }; + _context.Employees.Add(employee); + await _context.SaveChangesAsync(); + + var token = await _userManager.GeneratePasswordResetTokenAsync(user); + var resetLink = Url.Action("ResetPassword", "Account", new { token, email = user.Email }, Request.Scheme); + + // Send Email + await _emailSender.SendEmailAsync(user.Email, "Set Password", $"Click here to set your password: {resetLink}"); + } + else + { + var existingEmployee = await _context.Employees.FirstOrDefaultAsync(e => e.Id == model.Id); + if (existingEmployee != null) + { + existingEmployee.FirstName = model.FirstName; + existingEmployee.LastName = model.LastName; + existingEmployee.TenantId = TenantId; + + _context.Employees.Update(existingEmployee); + } + else + { + // Create Employee record if missing + var newEmployee = new Employee + { + ApplicationUserId = null, + FirstName = model.FirstName, + LastName = model.LastName, + TenantId = TenantId, + CurrentAddress = model.CurrentAddress, + BirthDate = Convert.ToDateTime(model.BirthDate), + EmergencyPhoneNumber = model.EmergencyPhoneNumber, + AadharNumber = model.AadharNumber, + Gender = model.Gender, + MiddleName = model.MiddleName, + PanNumber = model.PanNumber, + PeramnentAddress = model.PeramnentAddress, + PhoneNumber = model.PhoneNumber, + Photo = GetFileDetails(model.Photo).Result.FileData + + }; + _context.Employees.Add(newEmployee); + } + + await _context.SaveChangesAsync(); + } + + // Generate Password Reset Link + + + return Ok(new { message = "User created successfully. Password reset link sent." }); + } + + private static async Task GetFileDetails(IFormFile file) + { + FileDetails info = new FileDetails(); + info.ContentType = file.ContentType; + info.FileName = file.FileName; + + using (var memoryStream = new MemoryStream()) + { + await file.CopyToAsync(memoryStream); + info.FileData = memoryStream.ToArray(); + } + return info; + + } + } +} diff --git a/Marco.Pms.Services/Controllers/FeatureController.cs b/Marco.Pms.Services/Controllers/FeatureController.cs new file mode 100644 index 0000000..f4e8c7b --- /dev/null +++ b/Marco.Pms.Services/Controllers/FeatureController.cs @@ -0,0 +1,56 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.ViewModels; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace MarcoBMS.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + // [Authorize] + public class FeatureController : ControllerBase + { + private readonly ApplicationDbContext _context; + + private readonly UserManager _userManager; + + public FeatureController(UserManager userManager, ApplicationDbContext context) + { + _context = context; + _userManager = userManager; + } + + private ICollection GetFeaturePermissionVMs(Feature model) + { + ICollection features = []; + foreach (FeaturePermission permission in model.FeaturePermissions) + { + FeaturePermissionVM item = permission.ToFeaturePermissionVMFromFeaturePermission(); + features.Add(item); + } + + return features; + } + + [HttpGet] + public async Task GetAllFeatures() + { + var roles = await _context.Features.Include("FeaturePermissions").Include("Module").ToListAsync(); + + var rolesVM = roles.Select(c => new FeatureVM() + { + Id = c.Id, + Name = c.Name, + Description = c.Description, + FeaturePermissions = GetFeaturePermissionVMs(c), + ModuleId = c.ModuleId, + ModuleName = c.Module.Name, + IsActive = c.IsActive + }); + return Ok(rolesVM); + } + } +} diff --git a/Marco.Pms.Services/Controllers/FileController.cs b/Marco.Pms.Services/Controllers/FileController.cs new file mode 100644 index 0000000..ab77138 --- /dev/null +++ b/Marco.Pms.Services/Controllers/FileController.cs @@ -0,0 +1,79 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Employees; +using Marco.Pms.Model.Utilities; +using Microsoft.AspNetCore.Mvc; + +namespace MarcoBMS.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class FileController : ControllerBase + { + private readonly ApplicationDbContext _context; + private readonly IWebHostEnvironment _hostEnvironment; + + + public FileController(ApplicationDbContext context, IWebHostEnvironment hostEnvironment) + { + _context = context; + _hostEnvironment = hostEnvironment; + } + [HttpPost("fileupload")] + public async Task FileUploadDemo([FromForm] DemoEmployeeModel model) + { + string imageName = await Saveimage(model.ImageFile); + return Ok(); + } + + [NonAction] + public async Task Saveimage(IFormFile file) + { + string imageName = new string(Path.GetFileNameWithoutExtension(file.FileName).Take(10).ToArray()).Replace(" ", "-"); + + imageName = imageName + DateTime.Now.ToString("yyyymmssfff") + Path.GetExtension(file.FileName); + + var imagePath = Path.Combine(_hostEnvironment.ContentRootPath, "images", imageName); + using (var fileStream = new FileStream(imagePath, FileMode.Create)) + { + await file.CopyToAsync(fileStream); + } + return imageName; + } + + [HttpPost("manage1")] + public async Task CreateUser_1([FromForm] CreateUserDto model) + { + if (model == null) + return BadRequest("Invalid user data."); + + await GetFileDetails(model.Photo); + + return Ok(new { message = "User created successfully. Password reset link sent." }); + } + + private static async Task GetFileDetails(IFormFile file) + { + FileDetails info = new FileDetails(); + info.ContentType = file.ContentType; + info.FileName = file.FileName; + + using (var memoryStream = new MemoryStream()) + { + await file.CopyToAsync(memoryStream); + info.FileData = memoryStream.ToArray(); + } + return info; + } + } + + public class DemoEmployeeModel + { + public int EmployeeId { get; set; } + public string? EmployeeName { get; set; } + public string? Occupation { get; set; } + public string? ImageName { get; set; } + public string ImageSrc { get; set; } + + public IFormFile? ImageFile { get; set; } // List to handle multiple files + } +} diff --git a/Marco.Pms.Services/Controllers/ProjectController.cs b/Marco.Pms.Services/Controllers/ProjectController.cs new file mode 100644 index 0000000..8b0fecd --- /dev/null +++ b/Marco.Pms.Services/Controllers/ProjectController.cs @@ -0,0 +1,467 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Activities; +using Marco.Pms.Model.Dtos.Project; +using Marco.Pms.Model.Employees; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Projects; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace MarcoBMS.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + [Authorize] + public class ProjectController : ControllerBase + { + private readonly IUnitOfWork _unitOfWork; + private readonly ApplicationDbContext _context; + private ApplicationUser _applicationUser; + private readonly IProjectRepository _projectrepo; + private readonly UserManager _userManager; + + public ProjectController(UserManager userManager, IProjectRepository projectrepo, IUnitOfWork unitOfWork, ApplicationDbContext context) + { + _unitOfWork = unitOfWork; + _context = context; + _projectrepo = projectrepo; + _userManager = userManager; + + } + [HttpGet("list")] + public async Task GetAll() + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + List project = await _projectrepo.GetAllAsync(); + // var commentDto = comments.Select(x => x.ToCommentDto()); + + return Ok(project); + } + + [HttpGet("get/{id:int}")] + public async Task Get([FromRoute] int id) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + + var project = _projectrepo.Get(c => c.Id == id); //_context.Stock.FindAsync(id); + + // List project = await _projectrepo.GetAsync(id); + + return Ok(project); + } + + [HttpGet("details/{id:int}")] + public async Task Details([FromRoute] int id) + { + // ProjectDetailsVM vm = new ProjectDetailsVM(); + + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + + var projects = await _projectrepo.GetAsync((c => c.Id == id), includeProperties: "ProjectStatus,Tenant"); //_context.Stock.FindAsync(id); + + if (projects == null) + { + //vm.project = new Project(); + //vm.buildings = new List(); + //vm.floors = new List(); + //vm.workAreas = new List(); + } + else + { + var project = projects.Where(c => c.Id == id).SingleOrDefault(); + ProjectDetailsVM vm = GetProjectViewModel(id, project); + + ProjectVM projectVM = new ProjectVM(); + projectVM.Id = vm.project.Id; + projectVM.Name = vm.project.Name; + projectVM.ProjectAddress = vm.project.ProjectAddress; + projectVM.ContactPerson = vm.project.ContactPerson; + projectVM.StartDate = vm.project.StartDate; + projectVM.EndDate = vm.project.EndDate; + projectVM.ProjectStatusId = vm.project.ProjectStatusId; + projectVM.Buildings = new List(); + foreach (Building build in vm.buildings) + { + BuildingVM buildVM = new BuildingVM() { Id = build.Id, Description = build.Description, Name = build.Name }; + buildVM.Floors = new List(); + foreach (Floor floorDto in vm.floors.Where(c => c.BuildingId == build.Id).ToList()) + { + FloorsVM floorVM = new FloorsVM() { FloorName = floorDto.FloorName, Id = floorDto.Id }; + floorVM.WorkAreas = new List(); + + foreach (WorkArea workAreaDto in vm.workAreas.Where(c => c.FloorId == floorVM.Id).ToList()) + { + WorkAreaVM workAreaVM = new WorkAreaVM() { Id = workAreaDto.Id, AreaName = workAreaDto.AreaName, WorkItems = new List() }; + + foreach (WorkItem workItemDto in vm.workItems.Where(c => c.WorkAreaId == workAreaDto.Id).ToList()) + { + WorkItemVM workItemVM = new WorkItemVM() { WorkItemId = workItemDto.Id, WorkItem = workItemDto }; + workItemVM.WorkItem.WorkArea = null; + workItemVM.WorkItem.ActivityMaster.Tenant = null; + workItemVM.WorkItem.Tenant = null; + + + + workAreaVM.WorkItems.Add(workItemVM); + } + + floorVM.WorkAreas.Add(workAreaVM); + } + + buildVM.Floors.Add(floorVM); + } + projectVM.Buildings.Add(buildVM); + } + + return Ok(projectVM); + } + + return Ok(new ProjectVM()); + } + + private ProjectDetailsVM GetProjectViewModel(int? id, Project project) + { + ProjectDetailsVM vm = new ProjectDetailsVM(); + + // List buildings = _unitOfWork.Building.GetAll(c => c.ProjectId == id).ToList(); + List buildings = _context.Buildings.Where(c => c.ProjectId == id).ToList(); + List idList = buildings.Select(o => o.Id).ToList(); + // List floors = _unitOfWork.Floor.GetAll(c => idList.Contains(c.Id)).ToList(); + List floors = _context.Floor.Where(c => idList.Contains(c.BuildingId)).ToList(); + idList = floors.Select(o => o.Id).ToList(); + //List workAreas = _unitOfWork.WorkArea.GetAll(c => idList.Contains(c.Id), includeProperties: "WorkItems,WorkItems.ActivityMaster").ToList(); + + List workAreas = _context.WorkAreas.Where(c => idList.Contains(c.FloorId)).ToList(); + + idList = floors.Select(o => o.Id).ToList(); + List workItems = _unitOfWork.WorkItem.GetAll(c => idList.Contains(c.WorkAreaId), includeProperties: "ActivityMaster").ToList(); + + vm.project = project; + vm.buildings = buildings; + vm.floors = floors; + vm.workAreas = workAreas; + vm.workItems = workItems; + + return vm; + } + + private int GetTenantId() + { + var tenant = User.FindFirst("TenantId")?.Value; + return (tenant != null ? Convert.ToInt32(tenant) : 1); + } + + [HttpPost] + public async Task Create([FromBody] CreateProjectDto projectDto) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + + int TenantId = GetTenantId(); + var projectModel = projectDto.ToProjectFromCreateProjectDto(TenantId); + + var result = await _projectrepo.CreateAsync(projectModel); + + return Ok(result); + + } + + [HttpGet("get-allocation/{projectId:int}")] + public async Task GetAllocation([FromRoute] int projectId) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + + List allocations = await _unitOfWork.ProjectAllocation.GetAsync(c => c.ProjectId == projectId); + allocations = allocations.Where(c => c.ProjectId == projectId).ToList(); + + return Ok(allocations); + } + + [HttpPut] + [Route("update/{id:int}")] + public async Task Update([FromRoute] int id, [FromBody] UpdateProjectDto updateProjectDto) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + try + { + int TenantId = GetTenantId(); + updateProjectDto.TenantId = TenantId; + var projectModel = await _projectrepo.UpdateAsync(id, updateProjectDto); + + if (projectModel == null) + { + return NotFound("Project not found"); + } + return Ok(projectModel.ToProjectDto()); + } + catch (Exception ex) + { + return Ok(null); + } + } + + + [HttpPost("assign-employee")] + public async Task AssignEmployee(int? allocationid, int employeeId, int projectId) + { + var employee = await _context.Employees.FindAsync(employeeId); + var project = _projectrepo.Get(c => c.Id == projectId); + if (employee == null || project == null) + { + return NotFound(); + } + + // Logic to add the product to a new table (e.g., selected products) + + if (allocationid == null) + { + // Add allocation + ProjectAllocation allocation = new ProjectAllocation() + { + EmployeeId = employeeId, + ProjectId = project.Id, + AllocationDate = DateTime.UtcNow, + //EmployeeRole = employee.Rol + TenantId = project.TenantId + }; + + _unitOfWork.ProjectAllocation.CreateAsync(allocation); + } + else + { + //remove allocation + var allocation = await _context.ProjectAllocations.FindAsync(allocationid); + if (allocation != null) + { + allocation.ReAllocationDate = DateTime.UtcNow; + + _unitOfWork.ProjectAllocation.UpdateAsync(allocation.Id, allocation); + } + else + { + return NotFound(); + } + } + + return Ok(); + } + + [HttpGet] + [Route("allocation/{projectId:int}")] + public async Task GetProjectAllocation(int? projectId) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + int TenantId = GetTenantId(); + + var employees = await _context.ProjectAllocations.Where(c => c.TenantId == TenantId && c.ProjectId == projectId ).Include(e => e.Employee).Select(e=> new + { + ID = e.Id, + EmployeeId = e.EmployeeId, + ProjectId = e.ProjectId, + RoleID = e.EmployeeRoleId, + AllocationDate = e.AllocationDate, + ReAllocationDate = e.ReAllocationDate, + FirstName = e.Employee.FirstName, + LastName = e.Employee.LastName, + MiddleName = e.Employee.MiddleName, + IsActive = e.IsActive + + }).ToListAsync(); + + return Ok(ApiResponse.SuccessResponse(employees, "Success.", 200)); + } + + [HttpPost("allocation")] + public async Task ManageAllocation(List projectAllocationDot) + { + if (projectAllocationDot != null) + { + int TenentID = GetTenantId(); + + foreach (var item in projectAllocationDot) + { + try + { + ProjectAllocation projectAllocation = item.ToProjectAllocationFromProjectAllocationDto(TenentID); + ProjectAllocation projectAllocationFromDb =await _context.ProjectAllocations.Where(c => c.EmployeeId == projectAllocation.EmployeeId + && c.ProjectId == projectAllocation.ProjectId + && c.ReAllocationDate == null + && c.TenantId == TenentID).SingleOrDefaultAsync(); + + if (projectAllocationFromDb != null) + { + _context.ProjectAllocations.Attach(projectAllocationFromDb); + + if (item.Status) + { + projectAllocationFromDb.EmployeeRoleId = projectAllocation.EmployeeRoleId; ; + projectAllocationFromDb.IsActive = true; + _context.Entry(projectAllocationFromDb).Property(e => e.EmployeeRoleId).IsModified = true; + _context.Entry(projectAllocationFromDb).Property(e => e.IsActive).IsModified = true; + + } + else + { + projectAllocationFromDb.ReAllocationDate = DateTime.Now; + projectAllocationFromDb.IsActive = false; + _context.Entry(projectAllocationFromDb).Property(e => e.ReAllocationDate).IsModified = true; + _context.Entry(projectAllocationFromDb).Property(e => e.IsActive).IsModified = true; + + } + await _context.SaveChangesAsync(); + + } + else + { + projectAllocation.AllocationDate = DateTime.Now; + projectAllocation.IsActive = true; + _context.ProjectAllocations.Add(projectAllocation); + await _context.SaveChangesAsync(); + } + + } + catch (Exception ex) { } + + + } + return Ok(ApiResponse.SuccessResponse(null, "Data saved successfully.", 200)); + + } + return BadRequest(ApiResponse.ErrorResponse("Invalid details.", new { id = "Work Item Details are not valid." }, 400)); + + } + + [HttpPost("task")] + public async Task CreateProjectTask(List workItemDot) + { + if (workItemDot != null) + { + foreach (var item in workItemDot) + { + item.TenantId = GetTenantId(); + WorkItem workItem = item.ToWorkItemFromWorkItemDto(); + + if (item.Id > 0) + { + //update + + _unitOfWork.WorkItem.Update(workItem); + + } + else + { + + //create + _unitOfWork.WorkItem.Add(workItem); + + } + + _unitOfWork.Save(); + + } + + return Ok(ApiResponse.SuccessResponse(null, "Data saved successfully.", 200)); + } + + return BadRequest(ApiResponse.ErrorResponse("Invalid details.", new { id = "Work Item Details are not valid." }, 400)); + + } + [HttpPost("manage-infra")] + public async Task ManageProjectInfra(List infraDots) + + { + if (infraDots != null) + { + foreach (var item in infraDots) + { + if (item.Building != null) + { + + Building building = item.Building.ToBuildingFromBuildingDto(); + building.TenantId = GetTenantId(); + + if (item.Building.Id == 0) + { + //create + _unitOfWork.Building.Add(building); + } + else + { + //update + _unitOfWork.Building.Update(building); + } + + _unitOfWork.Save(); + } + if (item.Floor != null) + { + Floor floor = item.Floor.ToFloorFromFloorDto(); + floor.TenantId = GetTenantId(); + + if (item.Floor.Id == 0) + { + //create + _unitOfWork.Floor.Add(floor); + } + else + { + //update + _unitOfWork.Floor.Update(floor); + } + + _unitOfWork.Save(); + + } + if (item.WorkArea != null) + { + WorkArea workArea = item.WorkArea.ToWorkAreaFromWorkAreaDto(); + workArea.TenantId = GetTenantId(); + + if (item.WorkArea.Id == 0) + { + //create + _unitOfWork.WorkArea.Add(workArea); + } + else + { + //update + _unitOfWork.WorkArea.Update(workArea); + } + + _unitOfWork.Save(); + } + } + } + return Ok(); + } + + + } +} diff --git a/Marco.Pms.Services/Controllers/RolesController.cs b/Marco.Pms.Services/Controllers/RolesController.cs new file mode 100644 index 0000000..800e7a2 --- /dev/null +++ b/Marco.Pms.Services/Controllers/RolesController.cs @@ -0,0 +1,275 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Dtos.Roles; +using Marco.Pms.Model.Entitlements; +using Marco.Pms.Model.Mapper; +using Marco.Pms.Model.Utilities; +using Marco.Pms.Model.ViewModels; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using System.Data; + +namespace MarcoBMS.Services.Controllers +{ + [Route("api/[controller]")] + [ApiController] + [Authorize] + public class RolesController : ControllerBase + { + private readonly ApplicationDbContext _context; + + private readonly UserManager _userManager; + + public RolesController(UserManager userManager, ApplicationDbContext context) + { + _context = context; + _userManager = userManager; + + } + + private int GetTenantId() + { + var tenant = User.FindFirst("TenantId")?.Value; + return (tenant != null ? Convert.ToInt32(tenant) : 1); + } + + [HttpGet("jobrole")] + public async Task GetAllJobRoles() + { + int TenantId = GetTenantId(); + var roles = await _context.JobRoles.Where(c => c.TenantId == TenantId).Select(x => new JobRoleVM() + { + Id = x.Id, + Name = x.Name, + Description = x.Description + }).ToListAsync(); + + return Ok(roles); + } + + [HttpPost("jobrole")] + public async Task AddJobRole([FromBody] CreateJobRoleDto createJobRoleDto) + + { + + int TenantId = GetTenantId(); + if (await _context.JobRoles.AnyAsync(c => c.Name.ToLower() == createJobRoleDto.Name.ToLower() && c.TenantId == TenantId)) + { + return Ok(ApiResponse.SuccessResponse(null, "Role with same name already Exists.", 200)); + } + else + { + JobRole jr = createJobRoleDto.ToJobRoleFromCreateJobRoleDot(TenantId); + _context.JobRoles.Add(jr); + await _context.SaveChangesAsync(); + return Ok(ApiResponse.SuccessResponse(jr, "Success.", 200)); + } + } + + [HttpPut("jobrole/{id}")] + public async Task UpdateJobRole(string id, [FromBody] UpdateJobRoleDto updateRoleDto) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + if (id != updateRoleDto.Id.ToString()) + return BadRequest("Role ID mismatch"); + + try + { + int TenantId = GetTenantId(); + + JobRole jr = updateRoleDto.ToJobRoleFromUpdateJobRoleDot(TenantId); + _context.JobRoles.Update(jr); + await _context.SaveChangesAsync(); + return Ok(ApiResponse.SuccessResponse(jr, "Success.", 200)); + + } + catch (Exception ex) + { + return Ok(null); + } + } + + + [HttpGet] + public async Task GetAllRoles() + { + int TenantId = GetTenantId(); + + var roles = await _context.ApplicationRoles.Where(c => c.TenantId == TenantId).ToListAsync(); + + + var roleFeaturePermissions = await _context.RolePermissionMappings + .Join( + _context.FeaturePermissions, + rfp => rfp.FeaturePermissionId, + fp => fp.Id, + (rfp, fp) => new { rfp.ApplicationRoleId, FeaturePermission = fp }) + .Join( + _context.ApplicationRoles, + result => result.ApplicationRoleId, + role => role.Id, + (result, role) => new { Role = role, result.FeaturePermission }) + .Where(x => x.Role.TenantId == TenantId) // Filter by TenantId + .Select(x => new + { + RoleId = x.Role.Id, + RoleName = x.Role.Role, + FeaturePermission = x.FeaturePermission + }) + .ToListAsync(); + + List applicationRoles = new List(); + + foreach (var item in roles) + { + var rolesVM = new ApplicationRolesVM() + { + Id = item.Id, + Role = item.Role, + Description = item.Description, + FeaturePermission = [] + }; + + ICollection permissions = roleFeaturePermissions.Where(c => c.RoleId == item.Id) + .Select(c => c.FeaturePermission).ToList(); + + foreach (var permission in permissions) + { + rolesVM.FeaturePermission.Add( + new FeaturePermissionVM() + { + Id = permission.Id, + Description = permission.Description, + FeatureId = permission.FeatureId, + IsEnabled = permission.IsEnabled, + Name = permission.Name + }); + } + + applicationRoles.Add(rolesVM); + + } + + + return Ok(applicationRoles); + } + + + [HttpPost] + public async Task AddRole([FromBody] CreateApplicationRoleDto createRoleDto) + { + if (!ModelState.IsValid) + return BadRequest(ModelState); + + int TenantId = GetTenantId(); + + if (createRoleDto.FeaturesPermission == null || (createRoleDto.FeaturesPermission != null && createRoleDto.FeaturesPermission.Count == 0)) + { + return BadRequest(new { Message = "Feature Permission is required." }); + } + ApplicationRole role = createRoleDto.ToApplicationRoleFromCreateDto(TenantId); + _context.ApplicationRoles.Add(role); + + foreach (var permission in createRoleDto.FeaturesPermission) + { + var item = new RolePermissionMappings() { ApplicationRoleId = role.Id, FeaturePermissionId = permission.Id }; + bool assigned = _context.RolePermissionMappings.Any(c => c.ApplicationRoleId == role.Id && c.FeaturePermissionId == permission.Id); + if (permission.IsEnabled && !assigned) + _context.RolePermissionMappings.Add(item); + else + _context.RolePermissionMappings.Remove(item); + } + + await _context.SaveChangesAsync(); + return CreatedAtAction(nameof(GetRoleById), new { id = role.Id }, role.ToRoleVMFromApplicationRole()); + } + + [HttpPut("{id}")] + public async Task UpdateRole(string id, [FromBody] UpdateApplicationRoleDto updateRoleDto) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + if (id != updateRoleDto.Id.ToString()) + return BadRequest("Role ID mismatch"); + + try + { + int TenantId = GetTenantId(); + + ApplicationRole role = updateRoleDto.ToApplicationRoleFromUpdateDto(TenantId); + + if (role.TenantId != TenantId) + return Unauthorized(); + + var projectModel = _context.ApplicationRoles.Update(role); + + if (projectModel == null) + { + return NotFound("Project not found"); + } + + foreach (var permission in updateRoleDto.FeaturesPermission) + { + var item = new RolePermissionMappings() { ApplicationRoleId = role.Id, FeaturePermissionId = permission.Id }; + bool assigned = _context.RolePermissionMappings.Any(c => c.ApplicationRoleId == role.Id && c.FeaturePermissionId == permission.Id); + if (permission.IsEnabled && !assigned) + _context.RolePermissionMappings.Add(item); + else + _context.RolePermissionMappings.Remove(item); + + } + return Ok(role.ToRoleVMFromApplicationRole()); + } + catch (Exception ex) + { + return Ok(null); + } + } + + + [HttpGet("{id}")] + public async Task GetRoleById(Guid id) + { + int TenantId = GetTenantId(); + + var role = await _context.ApplicationRoles.FindAsync(id); + + if (role == null) + return NotFound(); + + if (role.TenantId != TenantId) + return Unauthorized(); + + var featurePermissions = await _context.RolePermissionMappings + .Where(rfp => rfp.ApplicationRoleId == id) + .Join( + _context.FeaturePermissions, + rfp => rfp.FeaturePermissionId, + fp => fp.Id, + (rfp, fp) => new FeaturePermissionVM() + { + Id = fp.Id, + Name = fp.Name, + Description = fp.Description, + IsEnabled = fp.IsEnabled, + FeatureId = fp.FeatureId + }) + .ToListAsync(); + + ApplicationRolesVM vm = new ApplicationRolesVM() + { + Id = role.Id, + Role = role.Role, + FeaturePermission = featurePermissions + }; + + return Ok(vm); + } + } +} diff --git a/Marco.Pms.Services/Controllers/TaskController.cs b/Marco.Pms.Services/Controllers/TaskController.cs new file mode 100644 index 0000000..9e5d978 --- /dev/null +++ b/Marco.Pms.Services/Controllers/TaskController.cs @@ -0,0 +1,44 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace MarcoBMS.Services.Controllers +{ + [Authorize] + [Route("api/[controller]")] + [ApiController] + public class TaskController : ControllerBase + { + private readonly IUnitOfWork _unitOfWork; + private readonly ApplicationDbContext _context; + private ApplicationUser _applicationUser; + private readonly IActivityMasterRepository _activityRepo; + private readonly IHttpContextAccessor _httpContextAccessor; + + public TaskController(IActivityMasterRepository activityRepo, IUnitOfWork unitOfWork, ApplicationDbContext context, IHttpContextAccessor httpContextAccessor) + { + _unitOfWork = unitOfWork; + _context = context; + _activityRepo = activityRepo; + _httpContextAccessor = httpContextAccessor; + } + + [HttpGet] + [Route("activities")] + public async Task GetActivities() + { + var tenantId = _httpContextAccessor.HttpContext?.Items["TenantId"]?.ToString(); + + + var activities = await _activityRepo.GetAllAsync(c=>c.TenantId == Convert.ToInt32( tenantId)); + + return Ok(activities); + } + + + } +} diff --git a/Marco.Pms.Services/Controllers/WeatherForecastController.cs b/Marco.Pms.Services/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..fb5fcef --- /dev/null +++ b/Marco.Pms.Services/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace MarcoBMS.Services.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} \ No newline at end of file diff --git a/Marco.Pms.Services/Helpers/EmployeeHelper.cs b/Marco.Pms.Services/Helpers/EmployeeHelper.cs new file mode 100644 index 0000000..c455781 --- /dev/null +++ b/Marco.Pms.Services/Helpers/EmployeeHelper.cs @@ -0,0 +1,20 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Employees; +using Microsoft.EntityFrameworkCore; + +namespace MarcoBMS.Services.Helpers +{ + public class EmployeeHelper + { + private readonly ApplicationDbContext _context; + public EmployeeHelper(ApplicationDbContext context) { + _context = context; + } + + + public async Task GetEmployeeByID(int EmployeeID) + { + return await _context.Employees.FindAsync(EmployeeID); + } + } +} diff --git a/Marco.Pms.Services/Helpers/ProjectHelper.cs b/Marco.Pms.Services/Helpers/ProjectHelper.cs new file mode 100644 index 0000000..528a3b9 --- /dev/null +++ b/Marco.Pms.Services/Helpers/ProjectHelper.cs @@ -0,0 +1,37 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Projects; +using Microsoft.CodeAnalysis; +using Microsoft.EntityFrameworkCore; + + +namespace MarcoBMS.Services.Helpers +{ + public class ProjectHelper + { + private readonly ApplicationDbContext _context; + public ProjectHelper(ApplicationDbContext context) + { + _context = context; + } + + public async Task> GetTeamByProject(int TenantId, int ProjectId, bool IncludeInactive) + { + if (IncludeInactive) + { + + var employees = await _context.ProjectAllocations.Where(c => c.TenantId == TenantId && c.ProjectId == ProjectId).Include(e => e.Employee).ToListAsync(); + + return employees; + } + else + { + var employees = await _context.ProjectAllocations.Where(c => c.TenantId == TenantId && c.ProjectId == ProjectId && c.IsActive == true).Include(e => e.Employee).ToListAsync(); + + return employees; + } + } + + + + } + } diff --git a/Marco.Pms.Services/Marco.Pms.Services.csproj b/Marco.Pms.Services/Marco.Pms.Services.csproj new file mode 100644 index 0000000..2a1f97d --- /dev/null +++ b/Marco.Pms.Services/Marco.Pms.Services.csproj @@ -0,0 +1,46 @@ + + + + net8.0 + enable + enable + True + False + 55935cea-fc40-40f8-be42-da094f06b11f + Linux + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + diff --git a/Marco.Pms.Services/Middleware/ExceptionHandlingMiddleware.cs b/Marco.Pms.Services/Middleware/ExceptionHandlingMiddleware.cs new file mode 100644 index 0000000..5a6f3cc --- /dev/null +++ b/Marco.Pms.Services/Middleware/ExceptionHandlingMiddleware.cs @@ -0,0 +1,39 @@ +namespace MarcoBMS.Services.Middleware +{ + public class ExceptionHandlingMiddleware + { + private readonly RequestDelegate _next; + + public ExceptionHandlingMiddleware(RequestDelegate next) + { + _next = next; + } + + public async Task Invoke(HttpContext context) + { + try + { + await _next(context); + } + catch (Exception ex) + { + await HandleExceptionAsync(context, ex); + } + } + + private Task HandleExceptionAsync(HttpContext context, Exception exception) + { + var response = new + { + message = exception.Message, + detail = exception.StackTrace, + statusCode = StatusCodes.Status500InternalServerError + }; + + context.Response.ContentType = "application/json"; + context.Response.StatusCode = StatusCodes.Status500InternalServerError; + + return context.Response.WriteAsJsonAsync(response); + } + } +} diff --git a/Marco.Pms.Services/Middleware/TenantMiddleware.cs b/Marco.Pms.Services/Middleware/TenantMiddleware.cs new file mode 100644 index 0000000..fe5aaf0 --- /dev/null +++ b/Marco.Pms.Services/Middleware/TenantMiddleware.cs @@ -0,0 +1,30 @@ +namespace MarcoBMS.Services.Middleware +{ + public class TenantMiddleware + { + private readonly RequestDelegate _next; + + public TenantMiddleware(RequestDelegate next) + { + _next = next; + } + + public async Task Invoke(HttpContext context) + { + if (context.User.Identity.IsAuthenticated) + { + var tenantId = context.User.FindFirst("tenantId")?.Value; + if (tenantId == null) + { + tenantId = "1"; + } + if (!string.IsNullOrEmpty(tenantId)) + { + context.Items["TenantId"] = tenantId; + } + } + + await _next(context); + } + } +} diff --git a/Marco.Pms.Services/Program.cs b/Marco.Pms.Services/Program.cs new file mode 100644 index 0000000..c2a26b1 --- /dev/null +++ b/Marco.Pms.Services/Program.cs @@ -0,0 +1,162 @@ +using BulkyBook.DataAccess.Repository; +using Marco.Pms.DataAccess.Data; +using Marco.Pms.DataAccess.Repository; +using Marco.Pms.DataAccess.Repository.IRepository; +using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Utilities; +using MarcoBMS.Services.Helpers; +using MarcoBMS.Services.Middleware; +using MarcoBMS.Services.Service; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.IdentityModel.Tokens; +using Microsoft.OpenApi.Models; +using Serilog; +using System.Text; + + +var builder = WebApplication.CreateBuilder(args); + + +// Add Serilog Configuration +builder.Host.UseSerilog((context, config) => +{ + config + .WriteTo.Console(); // Optional: Log to console + // .WriteTo.MongoDB("mongodb://localhost:27017/logs", collectionName: "api_logs"); +}); + +// Add services +builder.Services.AddCors(options => +{ + options.AddPolicy("DevCorsPolicy", policy => + { + policy.AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader(); + }); +}); + +//builder.Services.AddCors(options => +//{ +// options.AddPolicy("ProdCorsPolicy", policy => +// { +// policy.WithOrigins("https://yourdomain.com", "https://anothertrustedsource.com") // List of allowed origins +// .AllowAnyMethod() +// .AllowAnyHeader(); +// }); +//}); + +// Add services to the container. +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); +builder.Services.AddSwaggerGen(option => +{ + option.SwaggerDoc("v1", new OpenApiInfo { Title = "Demo API", Version = "v1" }); + option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme + { + In = ParameterLocation.Header, + Description = "Please enter a valid token", + Name = "Authorization", + Type = SecuritySchemeType.Http, + BearerFormat = "JWT", + Scheme = "Bearer" + }); + + option.AddSecurityRequirement(new OpenApiSecurityRequirement + { + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference + { + Type=ReferenceType.SecurityScheme, + Id="Bearer" + } + }, + new string[]{} + } + }); +}); + +builder.Services.Configure(builder.Configuration.GetSection("EmailSettings")); +builder.Services.AddTransient(); + +builder.Services.AddIdentity().AddEntityFrameworkStores().AddDefaultTokenProviders(); + + +string connString = builder.Configuration.GetConnectionString("DefaultConnectionString"); + +builder.Services.AddDbContext(options => +{ + options.UseMySql(connString, ServerVersion.AutoDetect(connString)); +}); + +builder.Services.AddMemoryCache(); + + +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); + + + + +builder.Services.AddScoped(); + +builder.Services.AddScoped(); + + +var jwtSettings = builder.Configuration.GetSection("Jwt").Get(); +builder.Services.AddAuthentication(options => +{ + options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; + options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; +}) +.AddJwtBearer(options => +{ + options.TokenValidationParameters = new TokenValidationParameters + { + ValidateIssuer = true, + ValidateAudience = true, + ValidateLifetime = true, + ValidateIssuerSigningKey = true, + ValidIssuer = jwtSettings.Issuer, + ValidAudience = jwtSettings.Audience, + IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSettings.Key)) + }; +}); + +builder.Services.AddSingleton(jwtSettings); + +var app = builder.Build(); + + + + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); + // Use CORS in the pipeline + app.UseCors("DevCorsPolicy"); +} + +app.UseSerilogRequestLogging(); // Log HTTP requests +app.UseHttpsRedirection(); +app.UseMiddleware(); +app.UseMiddleware(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/Marco.Pms.Services/Properties/launchSettings.json b/Marco.Pms.Services/Properties/launchSettings.json new file mode 100644 index 0000000..2de4f55 --- /dev/null +++ b/Marco.Pms.Services/Properties/launchSettings.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:33135", + "sslPort": 44357 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5032", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + //"https": { + // "commandName": "Project", + // "dotnetRunMessages": true, + // "launchBrowser": true, + // "launchUrl": "swagger", + // "applicationUrl": "https://localhost:7267;http://localhost:5032", + // "environmentVariables": { + // "ASPNETCORE_ENVIRONMENT": "Development" + // } + //}, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Marco.Pms.Services/Service/EmailSender.cs b/Marco.Pms.Services/Service/EmailSender.cs new file mode 100644 index 0000000..a619601 --- /dev/null +++ b/Marco.Pms.Services/Service/EmailSender.cs @@ -0,0 +1,35 @@ +using Marco.Pms.Model.Utilities; +using Microsoft.Extensions.Options; +using MailKit.Net.Smtp; +using MimeKit; + + +namespace MarcoBMS.Services.Service +{ public class EmailSender : IEmailSender + { + private readonly SmtpSettings _smtpSettings; + + public EmailSender(IOptions emailSettings) + { + _smtpSettings = emailSettings.Value; + } + + public async Task SendEmailAsync(string toEmail, string subject, string body) + { + var email = new MimeMessage(); + email.From.Add(new MailboxAddress(_smtpSettings.SenderName, _smtpSettings.SenderEmail)); + email.To.Add(MailboxAddress.Parse(toEmail)); + email.Subject = subject; + + var bodyBuilder = new BodyBuilder { HtmlBody = body }; + email.Body = bodyBuilder.ToMessageBody(); + + using var smtp = new SmtpClient(); + await smtp.ConnectAsync(_smtpSettings.SmtpServer, _smtpSettings.Port, MailKit.Security.SecureSocketOptions.StartTls); + await smtp.AuthenticateAsync(_smtpSettings.SenderEmail, _smtpSettings.Password); + await smtp.SendAsync(email); + await smtp.DisconnectAsync(true); + } + } + +} diff --git a/Marco.Pms.Services/Service/IEmailSender.cs b/Marco.Pms.Services/Service/IEmailSender.cs new file mode 100644 index 0000000..a5a5754 --- /dev/null +++ b/Marco.Pms.Services/Service/IEmailSender.cs @@ -0,0 +1,7 @@ +namespace MarcoBMS.Services.Service +{ + public interface IEmailSender + { + Task SendEmailAsync(string toEmail, string subject, string body); + } +} diff --git a/Marco.Pms.Services/Service/RefreshTokenService.cs b/Marco.Pms.Services/Service/RefreshTokenService.cs new file mode 100644 index 0000000..9909283 --- /dev/null +++ b/Marco.Pms.Services/Service/RefreshTokenService.cs @@ -0,0 +1,158 @@ +using Marco.Pms.DataAccess.Data; +using Marco.Pms.Model.Authentication; +using Marco.Pms.Model.Entitlements; +using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.IdentityModel.Tokens; +using Newtonsoft.Json.Linq; +using SharpCompress.Common; +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; +using System.Security.Cryptography; +using System.Text; + + +namespace MarcoBMS.Services.Service +{ + public class RefreshTokenService + { + private readonly ApplicationDbContext _context; + private readonly IMemoryCache _cache; // For optional JWT blacklisting + + + public RefreshTokenService(ApplicationDbContext context, IMemoryCache cache) + { + _context = context; + _cache = cache; + } + + public string GenerateJwtToken(string username, string tenantId, JwtSettings _jwtSettings) + { + + // Custom claims + var claims = new List + { + new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), + new Claim(JwtRegisteredClaimNames.Sub, username), + new Claim("TenantId", tenantId), // Add TenantId claim + new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) }; + + var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSettings.Key)); + var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); + + var token = new JwtSecurityToken( + issuer: _jwtSettings.Issuer, + audience: _jwtSettings.Audience, + claims: claims, + expires: DateTime.UtcNow.AddMinutes(_jwtSettings.ExpiresInMinutes), + signingCredentials: creds); + + return new JwtSecurityTokenHandler().WriteToken(token); + } + + public async Task CreateRefreshToken(string userId, string tenantId, JwtSettings _jwtSettings) + { + try + { + var tokenHandler = new JwtSecurityTokenHandler(); + var key = Encoding.UTF8.GetBytes(_jwtSettings.Key); + + var tokenDescriptor = new SecurityTokenDescriptor + { + Subject = new ClaimsIdentity(new[] + { + new Claim(ClaimTypes.NameIdentifier, userId), + new Claim("TenantId", tenantId), // Add TenantId claim + + new Claim("token_type", "refresh") // Custom claim to differentiate refresh tokens + }), + Expires = DateTime.UtcNow.AddDays(7), // Refresh token valid for 7 days + Issuer = _jwtSettings.Issuer, + Audience = _jwtSettings.Audience, + SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature) + }; + + var token = tokenHandler.CreateToken(tokenDescriptor); + string strToken = tokenHandler.WriteToken(token); + + var refreshToken = new RefreshToken + { + Token = strToken, + UserId = userId, + ExpiryDate = DateTime.UtcNow.AddDays(_jwtSettings.RefreshTokenExpiresInDays), + IsRevoked = false + }; + + // Check if the record exists + var existingEntity = await _context.RefreshTokens.AnyAsync(c=>c.UserId == userId); + if(existingEntity) { _context.RefreshTokens.Update(refreshToken); } else + { + _context.RefreshTokens.Add(refreshToken); + } + await _context.SaveChangesAsync(); + return strToken; + }catch(Exception ex) + { + throw; + } + } + + public async Task GetRefreshToken(string token) + { + return await _context.RefreshTokens.FirstOrDefaultAsync(rt => rt.Token == token && !rt.IsRevoked && !rt.IsUsed); + } + + public async Task MarkRefreshTokenAsUsed(RefreshToken refreshToken) + { + refreshToken.IsUsed = true; + _context.RefreshTokens.Update(refreshToken); + await _context.SaveChangesAsync(); + } + + public async Task RevokeRefreshToken(RefreshToken refreshToken) + { + refreshToken.IsRevoked = true; + refreshToken.RevokedAt = DateTime.UtcNow; + + _context.RefreshTokens.Update(refreshToken); + await _context.SaveChangesAsync(); + } + + // Revoke refresh token + public async Task RevokeRefreshTokenAsync(string refreshToken) + { + var token = await _context.RefreshTokens.FirstOrDefaultAsync(t => t.Token == refreshToken); + + if (token == null || token.IsRevoked || token.ExpiryDate <= DateTime.UtcNow) + return false; + + token.IsRevoked = true; + token.RevokedAt = DateTime.UtcNow; + + await _context.SaveChangesAsync(); + return true; + } + + // Optional: Blacklist JWT token + public Task BlacklistJwtTokenAsync(string jwtToken) + { + // Store the JWT token in memory cache with its expiry + var jwtExpiry = GetJwtExpiry(jwtToken); + if (jwtExpiry.HasValue) + { + _cache.Set(jwtToken, true, jwtExpiry.Value - DateTime.UtcNow); + } + + return Task.CompletedTask; + } + + private DateTime? GetJwtExpiry(string token) + { + var handler = new JwtSecurityTokenHandler(); + var jwtToken = handler.ReadToken(token) as JwtSecurityToken; + return jwtToken?.ValidTo; + } + + } +} diff --git a/Marco.Pms.Services/WeatherForecast.cs b/Marco.Pms.Services/WeatherForecast.cs new file mode 100644 index 0000000..ae298f3 --- /dev/null +++ b/Marco.Pms.Services/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace MarcoBMS.Services +{ + public class WeatherForecast + { + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} \ No newline at end of file diff --git a/Marco.Pms.Services/appsettings.Development.json b/Marco.Pms.Services/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Marco.Pms.Services/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Marco.Pms.Services/appsettings.json b/Marco.Pms.Services/appsettings.json new file mode 100644 index 0000000..bf639e3 --- /dev/null +++ b/Marco.Pms.Services/appsettings.json @@ -0,0 +1,38 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "ConnectionStrings": { + // "DefaultConnectionString": "Server=103.50.160.45;User ID=marcowvh_admin;Password=Marcoemp@123;Database=marcowvh_empattendanceci", + //"DefaultConnectionString": "Server=localhost;port=3333;User ID=root;Password=root;Database=MarcoBMS1", + "DefaultConnectionString": "Server=147.93.98.152;User ID=root;Password=MySqlUser@123$;Database=MarcoBMS1" + }, + "AllowedHosts": "*", + "Jwt": { + "Issuer": "http://localhost:5246", + "Audience": "http://localhost:5246", + "Key": "sworffishhkjfa9dnfdndfu33infnajfj", + "ExpiresInMinutes": 60, + "RefreshTokenExpiresInDays": 7 + }, + "SmtpSettings": { + "Server": "mail.marcobms.com", + "Port": 465, //587, + "SenderName": "Marco", + "SenderEmail": "vikas@marcobms.com", + "Username": "vikas@marcobms.com", + "Password": "MarcoVikas@123", + "EnableSsl": true + }, + "EmailSettings": { + "SmtpServer": "smtp.gmail.com", + "Port": 587, + "SenderName": "MarcoIoIT", + "SenderEmail": "marcoioitsoft@gmail.com", + "Password": "qrtq wfuj hwpp fhqr" + } + +} diff --git a/Marco.Pms.Services/images/100020945120255156127.jpg b/Marco.Pms.Services/images/100020945120255156127.jpg new file mode 100644 index 0000000..b668104 Binary files /dev/null and b/Marco.Pms.Services/images/100020945120255156127.jpg differ diff --git a/Marco.Pms.Services/images/171557095820255536368.jpeg b/Marco.Pms.Services/images/171557095820255536368.jpeg new file mode 100644 index 0000000..e7db931 Binary files /dev/null and b/Marco.Pms.Services/images/171557095820255536368.jpeg differ diff --git a/Marco.Pms.Services/images/Ashwini-Ph20255636854.png b/Marco.Pms.Services/images/Ashwini-Ph20255636854.png new file mode 100644 index 0000000..e25a761 Binary files /dev/null and b/Marco.Pms.Services/images/Ashwini-Ph20255636854.png differ diff --git a/Marco.Pms.Services/images/imageFile20254552980 b/Marco.Pms.Services/images/imageFile20254552980 new file mode 100644 index 0000000..b668104 Binary files /dev/null and b/Marco.Pms.Services/images/imageFile20254552980 differ diff --git a/Marco.Pms.Utility/DataConversionUtil.cs b/Marco.Pms.Utility/DataConversionUtil.cs new file mode 100644 index 0000000..997fb67 --- /dev/null +++ b/Marco.Pms.Utility/DataConversionUtil.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MarcoBMS.Utility +{ + public static class ParentToChildClassMapper + { + public static string ConvertToJson(this T obj) + { + return JsonConvert.SerializeObject(obj); + } + public static T ConvertToObject(this string json) + { + if (string.IsNullOrEmpty(json)) + { + return Activator.CreateInstance(); + } + return JsonConvert.DeserializeObject(json); + + } + } +} diff --git a/Marco.Pms.Utility/EmailSender.cs b/Marco.Pms.Utility/EmailSender.cs new file mode 100644 index 0000000..60d85e3 --- /dev/null +++ b/Marco.Pms.Utility/EmailSender.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Identity.UI.Services; + +namespace MarcoBMS.Utility +{ + public class EmailSender : IEmailSender + { + public Task SendEmailAsync(string email, string subject, string htmlMessage) + { + // Logic to send email + return Task.CompletedTask; + } + } +} diff --git a/Marco.Pms.Utility/Marco.Pms.Utility.csproj b/Marco.Pms.Utility/Marco.Pms.Utility.csproj new file mode 100644 index 0000000..032bffe --- /dev/null +++ b/Marco.Pms.Utility/Marco.Pms.Utility.csproj @@ -0,0 +1,14 @@ + + + + net7.0 + enable + enable + + + + + + + + diff --git a/Marco.Pms.Utility/SessionUtil.cs b/Marco.Pms.Utility/SessionUtil.cs new file mode 100644 index 0000000..e5ac2e5 --- /dev/null +++ b/Marco.Pms.Utility/SessionUtil.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Http; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MarcoBMS.Utility +{ + public class SessionUtil + { + public bool SetSession(string key, object obj ) + { + // HttpContext.Session.SetString(key, JsonConvert.SerializeObject(obj)); + return true; + } + } + +} diff --git a/Marco.Pms.Utility/enum.cs b/Marco.Pms.Utility/enum.cs new file mode 100644 index 0000000..b8e821c --- /dev/null +++ b/Marco.Pms.Utility/enum.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MarcoBMS.Utility +{ + public enum APP_ROLES + { + [Description("Management")] + Management = 0, + [Description("Admin")] + Admin = 1, + [Description("Management")] + SiteEngineer = 2, + [Description("SkilledWorker")] + SkilledWorker = 3, + [Description("UnSkilledWorker")] + UnskilledWorker = 4 + } + + public enum EMP_ROLES + { + [Description("Operator")] + Operator = 0, + [Description("Helper")] + Helper = 1, + [Description("Welder")] + Welder = 2, + [Description("Fitter")] + Fitter = 3 + + } + public enum PROJECT_STATUS + { + [Description("Active")] + Active = 0, + [Description("InProgress")] + InProgress = 1, + [Description("Hold")] + Hold = 2, + [Description("Completed")] + Completed = 3 + } + + public enum UnitOfMeasurement + { + Meter = 0, + Centimeter = 1, + Number = 2, + Area =3 + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..14c425d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# marco.pms.api +marco.pms.api and .net core webapi diff --git a/marco.pms.api.sln b/marco.pms.api.sln new file mode 100644 index 0000000..49d3e8c --- /dev/null +++ b/marco.pms.api.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marco.Pms.DataAccess", "Marco.Pms.DataAccess\Marco.Pms.DataAccess.csproj", "{D5FFA0DB-3EBE-4DD7-B831-A649EA48431A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marco.Pms.Model", "Marco.Pms.Model\Marco.Pms.Model.csproj", "{B3D239F2-7EB0-42D6-8892-AFBFEF17EDA9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Marco.Pms.Utility", "Marco.Pms.Utility\Marco.Pms.Utility.csproj", "{9EB569E6-17D4-477B-AD91-558E062CA788}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Marco.Pms.Services", "Marco.Pms.Services\Marco.Pms.Services.csproj", "{27A83653-5B7F-4135-9886-01594D54AFAE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5FFA0DB-3EBE-4DD7-B831-A649EA48431A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D5FFA0DB-3EBE-4DD7-B831-A649EA48431A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5FFA0DB-3EBE-4DD7-B831-A649EA48431A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D5FFA0DB-3EBE-4DD7-B831-A649EA48431A}.Release|Any CPU.Build.0 = Release|Any CPU + {B3D239F2-7EB0-42D6-8892-AFBFEF17EDA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B3D239F2-7EB0-42D6-8892-AFBFEF17EDA9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3D239F2-7EB0-42D6-8892-AFBFEF17EDA9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B3D239F2-7EB0-42D6-8892-AFBFEF17EDA9}.Release|Any CPU.Build.0 = Release|Any CPU + {9EB569E6-17D4-477B-AD91-558E062CA788}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9EB569E6-17D4-477B-AD91-558E062CA788}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9EB569E6-17D4-477B-AD91-558E062CA788}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9EB569E6-17D4-477B-AD91-558E062CA788}.Release|Any CPU.Build.0 = Release|Any CPU + {27A83653-5B7F-4135-9886-01594D54AFAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27A83653-5B7F-4135-9886-01594D54AFAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27A83653-5B7F-4135-9886-01594D54AFAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27A83653-5B7F-4135-9886-01594D54AFAE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0CBAB025-242A-43AA-8566-F1BE8BAE0077} + EndGlobalSection +EndGlobal